diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2010-12-04 00:16:21 -0500 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2010-12-04 00:16:21 -0500 |
| commit | b525bf771e31a2254f28bf25c6ed7987d64c8afb (patch) | |
| tree | 65583461edd171150f868f7f769635f43976d807 /contrib/pg_trgm/sql | |
| parent | b576757d7ee064ada5351c2e6a36c2f7234aa1d4 (diff) | |
| download | postgresql-b525bf771e31a2254f28bf25c6ed7987d64c8afb.tar.gz | |
Add KNNGIST support to contrib/pg_trgm.
Teodor Sigaev, with some revision by Tom
Diffstat (limited to 'contrib/pg_trgm/sql')
| -rw-r--r-- | contrib/pg_trgm/sql/pg_trgm.sql | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/contrib/pg_trgm/sql/pg_trgm.sql b/contrib/pg_trgm/sql/pg_trgm.sql index 20d86b8a0d..5e5539c005 100644 --- a/contrib/pg_trgm/sql/pg_trgm.sql +++ b/contrib/pg_trgm/sql/pg_trgm.sql @@ -26,6 +26,7 @@ CREATE TABLE test_trgm(t text); select t,similarity(t,'qwertyu0988') as sml from test_trgm where t % 'qwertyu0988' order by sml desc, t; select t,similarity(t,'gwertyu0988') as sml from test_trgm where t % 'gwertyu0988' order by sml desc, t; select t,similarity(t,'gwertyu1988') as sml from test_trgm where t % 'gwertyu1988' order by sml desc, t; +select t <-> 'q0987wertyu0988', t from test_trgm order by t <-> 'q0987wertyu0988' limit 2; create index trgm_idx on test_trgm using gist (t gist_trgm_ops); set enable_seqscan=off; @@ -33,6 +34,9 @@ set enable_seqscan=off; select t,similarity(t,'qwertyu0988') as sml from test_trgm where t % 'qwertyu0988' order by sml desc, t; select t,similarity(t,'gwertyu0988') as sml from test_trgm where t % 'gwertyu0988' order by sml desc, t; select t,similarity(t,'gwertyu1988') as sml from test_trgm where t % 'gwertyu1988' order by sml desc, t; +explain (costs off) +select t <-> 'q0987wertyu0988', t from test_trgm order by t <-> 'q0987wertyu0988' limit 2; +select t <-> 'q0987wertyu0988', t from test_trgm order by t <-> 'q0987wertyu0988' limit 2; drop index trgm_idx; create index trgm_idx on test_trgm using gin (t gin_trgm_ops); |
