https://questdb.io logo
Title
z

zale

12/18/2022, 12:26 PM
hello everyone, when you store the stock market, do you store one table for each stock code or do you store all market data in one table? And for stocks that split shares, how to deal with data updates, as far as I know, questdb cannot delete old data.
h

Holger

12/18/2022, 12:41 PM
All symbols in one table and get the data adjusted for splits when you download them.
i

Imre

12/18/2022, 1:34 PM
there is also support for UPDATE SQL command, you can run it via the web console or Postgres connection
however, you probably do not want to change the historical data
maybe just keep the splits in a separate table so you know when it happened, something like a
corporate_actions
table
z

zale

12/18/2022, 1:40 PM
UPDATE SQL cannot perform batch operations and guarantee atomicity, right?
i

Imre

12/18/2022, 1:42 PM
what do you mean by batch operations? prepared statements?
atomicity is not guaranteed, that is correct
z

zale

12/18/2022, 1:44 PM
Update multiple rows of data at once, such as the data of a certain stock from 2 years ago to today
i

Imre

12/18/2022, 1:44 PM
that can be done, you can update multiple rows at the same time
UPDATE table SET x=100; that would update all rows in the table
z

zale

12/18/2022, 1:48 PM
In other words, for example, the table now stores the 1-minute data of a certain symbol for 2 years, and then this symbol is split today, and now I have the data after the split for 2 years, the format is csv, at this time use How does UPDATE SQL update?
i

Imre

12/18/2022, 1:54 PM
maybe you could update the symbol to something else first and then just insert the new data.
UPDATE table SET symbol=‘VOD_OLD’ WHERE symbol=‘VOD;’ Then ingest updated data for VOD
if you have other fields in the table you want to keep that might make things a bit more comlicated as they will need to be copied
z

zale

12/18/2022, 1:58 PM
thx master, I see what you mean, this method seems to work.
i

Imre

12/18/2022, 1:58 PM
no worries