From 8436489c81c23af637696ac69cdaafddcc907ee1 Mon Sep 17 00:00:00 2001
From: Tom Lane <tgl@sss.pgh.pa.us>
Date: Wed, 2 Mar 2011 14:43:24 -0500
Subject: Add KNNGIST support to contrib/btree_gist.

This extends GiST's support for nearest-neighbor searches to many of the
standard data types.

Teodor Sigaev
---
 contrib/btree_gist/sql/timestamp.sql | 6 ++++++
 1 file changed, 6 insertions(+)

(limited to 'contrib/btree_gist/sql/timestamp.sql')

diff --git a/contrib/btree_gist/sql/timestamp.sql b/contrib/btree_gist/sql/timestamp.sql
index 25e942874eb..95effebfc47 100644
--- a/contrib/btree_gist/sql/timestamp.sql
+++ b/contrib/btree_gist/sql/timestamp.sql
@@ -16,6 +16,8 @@ SELECT count(*) FROM timestamptmp WHERE a >= '2004-10-26 08:55:08';
 
 SELECT count(*) FROM timestamptmp WHERE a >  '2004-10-26 08:55:08';
 
+SELECT a, a <-> '2004-10-26 08:55:08' FROM timestamptmp ORDER BY a <-> '2004-10-26 08:55:08' LIMIT 3;
+
 CREATE INDEX timestampidx ON timestamptmp USING gist ( a );
 
 SET enable_seqscan=off;
@@ -29,3 +31,7 @@ SELECT count(*) FROM timestamptmp WHERE a  = '2004-10-26 08:55:08'::timestamp;
 SELECT count(*) FROM timestamptmp WHERE a >= '2004-10-26 08:55:08'::timestamp;
 
 SELECT count(*) FROM timestamptmp WHERE a >  '2004-10-26 08:55:08'::timestamp;
+
+EXPLAIN (COSTS OFF)
+SELECT a, a <-> '2004-10-26 08:55:08' FROM timestamptmp ORDER BY a <-> '2004-10-26 08:55:08' LIMIT 3;
+SELECT a, a <-> '2004-10-26 08:55:08' FROM timestamptmp ORDER BY a <-> '2004-10-26 08:55:08' LIMIT 3;
-- 
cgit v1.2.3

