add materialized view to keep individual contract existences

This commit is contained in:
Avraham Sakal
2024-07-05 16:47:15 -04:00
parent cd9dd9fefc
commit df4925e3a4
+15
View File
@@ -23,6 +23,21 @@ CREATE TABLE option_contract_existences
ENGINE ReplacingMergeTree()
PRIMARY KEY (asOfDate, symbol)
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
(