May 20, 2003 at 9:15 am
for a system where items can be added, used for a while and then be made available again i would like to display the number of items that are available when the user lists the items...is it better to query a column with a counter which will be decremented each time an item is used or to do a select count to determine how many items are available based on the value in an availablity column? i think the counter column would be produce quicker results than the select statement, especially for longer lists...but what if two people click to use an item simultaneously...this could an incorrect result to be entered in the counter field...
May 20, 2003 at 10:32 am
Have to test on your system and see. How many items? If it's not a large enough table, it will be scanned anyway.
Steve Jones
http://qa.sqlservercentral.com/columnists/sjones
Follow me on Twitter: http://www.twitter.com/way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
May 20, 2003 at 10:43 am
i think i'll use transactions to ensure locking of rows being modified until the whole process is complete.
Edited by - pliant on 05/20/2003 10:43:34 AM
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply