add materialized view to keep individual contract existences

main
Avraham Sakal 10 months ago
parent cd9dd9fefc
commit df4925e3a4

@ -23,6 +23,21 @@ CREATE TABLE option_contract_existences
ENGINE ReplacingMergeTree() ENGINE ReplacingMergeTree()
PRIMARY KEY (asOfDate, symbol) PRIMARY KEY (asOfDate, symbol)
ORDER BY (asOfDate, symbol, expirationDate, strike, type); ORDER BY (asOfDate, symbol, expirationDate, strike, type);
CREATE MATERIALIZED VIEW option_contract_existences_mv TO option_contract_existences
AS
SELECT
toDate(tsStart) as asOfDate,
symbol,
expirationDate,
strike,
type
FROM option_contract_aggregates
GROUP BY
asOfDate,
symbol,
expirationDate,
strike,
type;
CREATE TABLE option_contracts CREATE TABLE option_contracts
( (

Loading…
Cancel
Save