mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-22 13:40:56 +08:00
Since create_hypertable() allows you to optionally specify a partitioning column, it makes sense to default to one partition when no column is specified and asking for the number of partitions when a column is specified and the number of partitions is not (instead of defaulting to one). This patch also changes the order and type of partitioning-related input arguments to create_hypertable() so that the number of partitions can easily be specified alongside the partitioning column and without type casting.
22 lines
674 B
SQL
22 lines
674 B
SQL
\set ON_ERROR_STOP 1
|
|
|
|
\o /dev/null
|
|
\ir include/insert_two_partitions.sql
|
|
|
|
\o
|
|
\set ECHO ALL
|
|
\c single
|
|
|
|
SELECT * FROM PUBLIC."testNs";
|
|
|
|
EXPLAIN (verbose ON, costs off) SELECT * FROM PUBLIC."testNs";
|
|
|
|
\echo "The following queries should NOT scan testNs._hyper_1_1_0_partition"
|
|
EXPLAIN (verbose ON, costs off) SELECT * FROM PUBLIC."testNs" WHERE device_id = 'dev20';
|
|
EXPLAIN (verbose ON, costs off) SELECT * FROM PUBLIC."testNs" WHERE device_id = 'dev'||'20';
|
|
EXPLAIN (verbose ON, costs off) SELECT * FROM PUBLIC."testNs" WHERE 'dev'||'20' = device_id;
|
|
|
|
--TODO: handle this later?
|
|
--EXPLAIN (verbose ON, costs off) SELECT * FROM "testNs" WHERE device_id IN ('dev20', 'dev21');
|
|
|