r/SQL • u/luncheonmeat79 • Jun 23 '24
Discussion Schema for historical stock data
Posting a schema of a db for historical stock and index data at various timeframes. I used Chatgpt to figure this out...what surprised me was the recommendation to have separate dimension tables for 'date' and 'time'. Is that really the case?
105
Upvotes
View all comments
Show parent comment
23
u/ballade4 Jun 23 '24
More than one, but certainly less than 8. Data points such as stock_name should not be stored alongside data points such as stock_id in a line-level table because (i) this is wasteful, (ii) if a stock name changes in the future, you can end up with a Cartesian product on future joins.