0

I have a Users table and a Totals table which has an integer field for the total number of users. I thought about writing a console app that counts the Users table and then updates the Totals table. And then make a Task scheduler events that executes this app every 10 minutes. Is there a more elegant way to do this?

2
  • Please clarify why you need a Totals table. Is there a business requirement for it? Doing a record count of "Users" will not have a performance impact - it's an extremely fast operation. Commented Jul 15, 2010 at 0:26
  • It has a few other system stats besides the user total and it doesn't have to be in real time. Commented Jul 15, 2010 at 0:31

1 Answer 1

1

Make the Totals table a view, so it doesn't need to be updated at all?

or ...

Update the Totals table with ON INSERT triggers on the Users table?

Sign up to request clarification or add additional context in comments.

1 Comment

This is exactly what triggers were made for.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.