From: | amihay gonen <agonenil(at)gmail(dot)com> |
---|---|
To: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Q: text query search and |
Date: | 2015-07-23 09:55:21 |
Message-ID: | CAKb+SBVFawu8=G0O9PkOhJkwWa==L_uc+ZD5VvHXtZw2vfCjJA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi I'm trying to implement a text search in PG .
My goal to enable the user search on several columns also on partial words.
here is sample code :
create table test_test( text_data tsvector, text_a varchar,text_b varchar);
insert into test_test(text_a,text_b) select 'name 10.10.2.3 ','name3 name'
from generate_series(1,500);
update test_test set text_data=to_tsvector(text_a||' '||text_b);
CREATE INDEX test_test_idx ON test_test USING gin(text_data);
explain ANALYZE select * from test_test where text_data@
@plainto_tsquery('name');
my questions are :
1. why the index is not used (I guess it is related to the way the data is
generated)
2, how can I use pg_trgm with ts_vector to enable to answer query like
10.10 or nam ?
the idea is to use the gin index , maybe there are other option without
using pg_trgm?
thanks
amihay
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Sullivan | 2015-07-23 11:05:51 | Re: Delete rule does not prevent truncate |
Previous Message | Spiros Ioannou | 2015-07-23 08:31:18 | Re: Lots of stuck queries after upgrade to 9.4 |