|
Posted by Erland Sommarskog on 05/28/05 00:46
sk (shripathikamath@hotmail.com) writes:
> Another question, performance-wise, is there a near-linear increase in
> cost for accessing latest values since the max seems to be computed
> each time, or is the cost 'not so bad' since the table is indexed by
> datetime?
Performance-wise a clustered index on (device_id, attribute, datetime)
would be to prefer.
It could also be worth considering of defining the attributes in a
seprate table, and only include the attribute in this table to
hold it down in size, which would also improve performance.
Finally, using [datetime] as the primary key seems funny. What if you
get two values close to each other in time? (Beware that datetime in
SQL Server does only have a resolution of 3.33 milliseconds.)
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp
Navigation:
[Reply to this message]
|