ClickHouse/tests/queries/0_stateless/03147_datetime64_constant_index_analysis.sql

13 lines
622 B
SQL

DROP TABLE IF EXISTS test;
CREATE TABLE test (d DateTime, PRIMARY KEY (d));
INSERT INTO test SELECT toDateTime('2024-01-01') + number FROM numbers(1e6);
SET max_rows_to_read = 10000;
SELECT count() FROM test WHERE d <= '2024-01-01 02:03:04';
SELECT count() FROM test WHERE d <= toDateTime('2024-01-01 02:03:04');
SELECT count() FROM test WHERE d <= toDateTime64('2024-01-01 02:03:04', 0);
SELECT count() FROM test WHERE d <= toDateTime64('2024-01-01 02:03:04', 3);
SET max_rows_to_read = 100_000;
SELECT count() FROM test WHERE d <= '2024-01-02';
SELECT count() FROM test WHERE d <= toDate('2024-01-02');
DROP TABLE test;