Ordered Timeseries data / Stock Market data using structure variants

流过昼夜 提交于 2019-12-13 01:23:58

问题


I'm looking into getting some advice on organizing the time-series information into the database. My current implementation is PostgreSQL with single table for all symbols. It is slow on getting customized information but very easy to append. Based on the information from here I wanted to replicate the structure of the database with creating a separate table per symbol. After thinking about it more careful I realized that it would be a bit hard for me to query multiple symbols based on some criteria like:

SELECT * FROM "all_symbols" WHERE closePrice >= 50

since I would need to combine those tables somehow for the search(It might be much easier than I think). I would also grow the number of tables by some unrealistic amount due to the fact that I record some statistical analysis(like stddev) per symbol per timeframe in a separate table.

My goal is to have fast and efficient database where I can read and combine the data any possible way for the analysis and research.

Almost forgot to mention that I am looking into the Open Source implementation.

Thank you in advance.


回答1:


Take a look into this project at GitHub, it's a free open source market data database based on top of the Microsoft SQL Server 2012:

http://github.com/kriasoft/market-data




回答2:


Put an index on closePrice, and use between instead of >=:

SELECT * FROM all_symbols
WHERE closePrice between 50 and <some large value>

one-sided ranges usually don't use an index, but between should use the index.



来源:https://stackoverflow.com/questions/10588933/ordered-timeseries-data-stock-market-data-using-structure-variants

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!