开发者

For financial data is it useful to index DATETIME?

开发者 https://www.devze.com 2023-03-17 16:25 出处:网络
Suppose I have a table STOCKCODE, DATETIME, PRICE I want to perform a basic query such as finding the maximum price between 12.00 PM and 3.00 PM on a given date for a given stock.Currently I index b

Suppose I have a table

STOCKCODE, DATETIME, PRICE

I want to perform a basic query such as finding the maximum price between 12.00 PM and 3.00 PM on a given date for a given stock. Currently I index by:

STOCKCODE, DATETIME, PRICE

DATETIME is granular down to the millisecond level in other words there is basically no duplicate data. For the type of query that I wish to perform is there a better way to index? Or more generally is 开发者_运维百科there a better schema that I could use?


I would say your approach is good, except the index on price, since datetime is granular enough, you won't have more than one (or two or maybe maybe three) entries of price per one stockcode+datetime combinations.

This is only to support the action you described above, if you have other actions, you might need (most probably) other things.

0

精彩评论

暂无评论...
验证码 换一张
取 消