How to design a database for stock data?

323 views
Skip to first unread message

JustFillBug

unread,
Mar 11, 2011, 1:24:14 AM3/11/11
to python...@googlegroups.com

A newbie question on database design. I'd like to store stock market
data into a sqlite database. I wonder how to partition the data?

I can think of 2 ways:

1. The data for each stock id quote are put into their own tables and a
map table to host the mapping of stock_id -> stock_table_name

2. All the data are put into a single big table. Query the data for a
particular stock id by it's ID number.

On option No.1. Since there could be a few thousand different stock
id's, which will corresponding to thousand of tables. Does sqlite handle
thousand tables in a single database file effeciently?

On option No.2. I guess updating and querying the data will be slower
than those of the option No.1.

What're the other better designs for this kind of data?


Rich Shepard

unread,
Mar 11, 2011, 11:39:13 AM3/11/11
to python...@googlegroups.com
On Fri, 11 Mar 2011, JustFillBug wrote:

> A newbie question on database design. I'd like to store stock market data
> into a sqlite database. I wonder how to partition the data?

The normal procedure for designing a database is to list _all_ the
attributes you want to store, then go through the normalization process of
assigning each to a table. Lots of information on this on the Web and in
books.

You will make a better decision after you decide what information other
than ID and company name you will enter and what you want to do with the
data once it's stored.

Rich

Reply all
Reply to author
Forward
0 new messages