James
James

Reputation: 82096

Best way of recording activity from a user in the database?

I am building an application that perform checks on users on specific days. I need to keep track of how many times these checks are performed against that particular user.

My initial thought was to just basically have a field in one of my tables which I just increment when the checks have been performed. My other thought was to create a table called "AuditUser" that will insert a new record each time the customer has been checked.

This is really a question of...What is the best practise approach?

If anyone else has a better solution please suggest.

Thanks in advance.

Upvotes: 3

Views: 252

Answers (3)

Bela
Bela

Reputation: 3464

If you will only ever need a count, I would go with the field that you increment.

If you are ever going to need to do anything else, such as determine the number of times checked within a range of dates, then I would use the second table.

Upvotes: 1

KM.
KM.

Reputation: 103579

use the AuditUser table, you will then have a record of each check (with date+time), which is better than just a count and a last date+time.

Upvotes: 0

RiddlerDev
RiddlerDev

Reputation: 7439

Use an audit table.

Then you can date partition and also archive to disk and shrink the table as needed.

Upvotes: 5

Related Questions