https://questdb.io logo
Title
s

sam

12/15/2022, 7:05 AM
CREATE TABLE 'hist-ohlc-daily-stg' (
  open DOUBLE,
  high DOUBLE,
  low DOUBLE,
  close DOUBLE,
  volume INT,
  datetime timestamp,
  symbol STRING
);
a

Andrey Pechkurov

12/15/2022, 7:21 AM
Try
CREATE TABLE 'hist-ohlc-daily-stg' (
  open DOUBLE,
  high DOUBLE,
  low DOUBLE,
  close DOUBLE,
  volume INT,
  datetime timestamp,
  symbol STRING
) TIMESTAMP(datetime) PARTITION BY DAY;
PARTITION BY can take a number of values: HOUR, DAY, WEEK, MONTH. Pick up whichever suits your data better.
s

sam

12/15/2022, 7:23 AM
thank you. I hv a table with data.. Is it possible to alter it ? or swapping of tables i need to do
a

Andrey Pechkurov

12/15/2022, 7:41 AM
You can create a new table and copy the data from the old one:
CREATE TABLE 'hist-ohlc-daily-stg-new' AS (
  SELECT *
  FROM 'hist-ohlc-daily-stg'
  ORDER BY datetime ASC
) TIMESTAMP(datetime) PARTITION BY DAY;
h

Holger

12/15/2022, 2:07 PM
Is 'float' not the better data type for OHLC data?
s

sam

12/15/2022, 7:15 PM
yes you are correct.. i was just doing some poc .. did not check the datatype and max value..