diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 12:19:15 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 12:19:15 +0000 |
commit | 6eb9c5a5657d1fe77b55cc261450f3538d35a94d (patch) | |
tree | 657d8194422a5daccecfd42d654b8a245ef7b4c8 /contrib/btree_gist/sql/interval.sql | |
parent | Initial commit. (diff) | |
download | postgresql-13-6eb9c5a5657d1fe77b55cc261450f3538d35a94d.tar.xz postgresql-13-6eb9c5a5657d1fe77b55cc261450f3538d35a94d.zip |
Adding upstream version 13.4.upstream/13.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'contrib/btree_gist/sql/interval.sql')
-rw-r--r-- | contrib/btree_gist/sql/interval.sql | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/contrib/btree_gist/sql/interval.sql b/contrib/btree_gist/sql/interval.sql new file mode 100644 index 0000000..346d6ad --- /dev/null +++ b/contrib/btree_gist/sql/interval.sql @@ -0,0 +1,43 @@ +-- 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'; + +SELECT count(*) FROM intervaltmp WHERE a <= '199 days 21:21:23'; + +SELECT count(*) FROM intervaltmp WHERE a = '199 days 21:21:23'; + +SELECT count(*) FROM intervaltmp WHERE a >= '199 days 21:21:23'; + +SELECT count(*) FROM intervaltmp WHERE a > '199 days 21:21:23'; + +SELECT a, a <-> '199 days 21:21:23' FROM intervaltmp ORDER BY a <-> '199 days 21:21:23' LIMIT 3; + +CREATE INDEX intervalidx ON intervaltmp USING gist ( a ); + +SET enable_seqscan=off; + +SELECT count(*) FROM intervaltmp WHERE a < '199 days 21:21:23'::interval; + +SELECT count(*) FROM intervaltmp WHERE a <= '199 days 21:21:23'::interval; + +SELECT count(*) FROM intervaltmp WHERE a = '199 days 21:21:23'::interval; + +SELECT count(*) FROM intervaltmp WHERE a >= '199 days 21:21:23'::interval; + +SELECT count(*) FROM intervaltmp WHERE a > '199 days 21:21:23'::interval; + +EXPLAIN (COSTS OFF) +SELECT a, a <-> '199 days 21:21:23' FROM intervaltmp ORDER BY a <-> '199 days 21:21:23' LIMIT 3; +SELECT a, a <-> '199 days 21:21:23' FROM intervaltmp ORDER BY a <-> '199 days 21:21:23' LIMIT 3; + +SET enable_indexonlyscan=off; + +EXPLAIN (COSTS OFF) +SELECT a, a <-> '199 days 21:21:23' FROM intervaltmp ORDER BY a <-> '199 days 21:21:23' LIMIT 3; +SELECT a, a <-> '199 days 21:21:23' FROM intervaltmp ORDER BY a <-> '199 days 21:21:23' LIMIT 3; |