mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-27 08:39:28 +08:00
67 lines
1.2 KiB
Plaintext
67 lines
1.2 KiB
Plaintext
-- interval check
|
|
CREATE TABLE intervaltmp (a interval);
|
|
\copy intervaltmp from 'data/interval.data'
|
|
SET enable_seqscan=on;
|
|
SELECT count(*) FROM intervaltmp WHERE a < '199 days 21:21:23';
|
|
count
|
|
-------
|
|
329
|
|
(1 row)
|
|
|
|
SELECT count(*) FROM intervaltmp WHERE a <= '199 days 21:21:23';
|
|
count
|
|
-------
|
|
330
|
|
(1 row)
|
|
|
|
SELECT count(*) FROM intervaltmp WHERE a = '199 days 21:21:23';
|
|
count
|
|
-------
|
|
1
|
|
(1 row)
|
|
|
|
SELECT count(*) FROM intervaltmp WHERE a >= '199 days 21:21:23';
|
|
count
|
|
-------
|
|
271
|
|
(1 row)
|
|
|
|
SELECT count(*) FROM intervaltmp WHERE a > '199 days 21:21:23';
|
|
count
|
|
-------
|
|
270
|
|
(1 row)
|
|
|
|
CREATE INDEX intervalidx ON intervaltmp USING gist ( a );
|
|
SET enable_seqscan=off;
|
|
SELECT count(*) FROM intervaltmp WHERE a < '199 days 21:21:23'::interval;
|
|
count
|
|
-------
|
|
329
|
|
(1 row)
|
|
|
|
SELECT count(*) FROM intervaltmp WHERE a <= '199 days 21:21:23'::interval;
|
|
count
|
|
-------
|
|
330
|
|
(1 row)
|
|
|
|
SELECT count(*) FROM intervaltmp WHERE a = '199 days 21:21:23'::interval;
|
|
count
|
|
-------
|
|
1
|
|
(1 row)
|
|
|
|
SELECT count(*) FROM intervaltmp WHERE a >= '199 days 21:21:23'::interval;
|
|
count
|
|
-------
|
|
271
|
|
(1 row)
|
|
|
|
SELECT count(*) FROM intervaltmp WHERE a > '199 days 21:21:23'::interval;
|
|
count
|
|
-------
|
|
270
|
|
(1 row)
|
|
|