January 21, 2007 at 6:42 am
No, Jeff, I'm getting on another kind of error.
Your solution will work only in "Single-point real time event recording system".
Only such kind of system could guarantee that Identity order in the table correlates with the actual order of events recorded in this table.
If there is human input, or new records arrived by some kind of messaging system (say, in XML files) then due to any delay in data transmission (e.g., one of data channels was off for some time) the later event may appear in the table before the earlier one.
And your method will keep 50 latest inserted, which not always must be latest happened events.
I would not consider rely on identity for such kind of tasks at all.
_____________
Code for TallyGenerator
January 21, 2007 at 8:56 am
Serqiy and Barry,
Heh... I finally drank enough coffee and now I get it... and I agree. Serqiy is absolutely correct.
Actually, my fault... All I saw was "the latest 50 rows" and that's pretty much open to interpretation until you see WHAT Barry is trying to use it for... a "Digital Dashboard". Depending on his requirements, neither "last 50 inserted" nor "latest 50 by date" may accomplish what he's looking for. It may be that he needs to preload the table with "settings to monitor" and, using updates, apply each new row by date/time to the setting it represents. If an unexpected row appears, it may represent a setting missed in the original requirements and, again depending on requirements, automatically be added to the table or, possibly, be added to a "do you want to add this setting?" table.
To summarize, because of the "Digital Dashboard" requirement, this should probably be a "merge" or "upsert" instead of simple deletions of all but the "last" 50.
Thanks for the feedback, Serqiy...
--Jeff Moden
Change is inevitable... Change for the better is not.
January 22, 2007 at 8:16 am
Hi Everyone,
Thank you all very much for taking the time to answer my query.
I should have been clearer in my initial posting. I want to keep the *most recent* 50 entries. My dashboard will display moving graphs, and as a new (chronological) entry arrive, the oldest one will drop off.
Also, there may be dozens of tables running in parallel, which is why I'm concerned about overhead.
I wish I could give you a number of new rows per second, but we're not that far along yet. Let's assume that a 'simpler' method (i.e. low overhead) method of dropping the last row would be more desirable than a 'complex' method.
Thanks again,
Barry
January 22, 2007 at 4:58 pm
Then you need to use something like what DC Clark posted based on a date column...
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 16 through 18 (of 18 total)
You must be logged in to reply to this topic. Login to reply