From: Kentaro H. <ha...@cl...> - 2017-07-31 08:58:41
|
Hi, On Thu, 27 Jul 2017 12:06:48 +0200 an...@ka... wrote: > Hi > > Thank your so much for your guidance, i am making some progress. > > The message id index is working correctly consistently. The subject index is not. > > For the subject index some queries use the index some do not. I have tried both > the v1 and v2 index types. > > > == Index > > CREATE INDEX pgroonga_messages_subject_idx ON messages USING pgroonga(id, subject pgroonga.text_full_text_search_ops_v2); It looks good. > Issue > ==== > > As you can see above when i search for "Cron" the index is not being used. If i search for "freshclam" > and "Anacron" the index is being used ? > > Thanks in advance. When you search by "Cron", actually indexes are not used. It seems that query planner selects seq scan as better one instead of index scan. Maybe the following query shows the cost about which way (seq scan or index scan) is reasonable. =# explain select id,subject,pgroonga.score(messages) from messages where subject &@ 'Cron'; =# SET enable_seqscan = off; =# explain select id,subject,pgroonga.score(messages) from messages where subject &@ 'Cron'; Regards, -- Kentaro Hayashi <ha...@cl...> |