Re: Full text search with ORDER BY performance issue

From: Devin Ben-Hur <dbenhur(at)whitepages(dot)com>
To: Krade <krade(at)krade(dot)com>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Full text search with ORDER BY performance issue
Date: 2009-07-21 01:13:43
Message-ID: 4A651647.6030205@whitepages.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Krade wrote:
> SELECT * FROM a WHERE comment_tsv @@ plainto_tsquery('love') ORDER BY
> timestamp DESC LIMIT 24 OFFSET 0;

Have you tried make the full-text condition in a subselect with "offset
0" to stop the plan reordering?

eg:

select *
from (
select * from a where comment_tsv @@ plainto_tsquery('love')
offset 0
) xx
order by timestamp DESC
limit 24
offset 0;

See http://blog.endpoint.com/2009/04/offset-0-ftw.html

--
-Devin

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Krade 2009-07-21 03:35:11 Re: Full text search with ORDER BY performance issue
Previous Message Alvaro Herrera 2009-07-21 01:00:17 Re: Help needed for reading postgres log : RE: Concurrency issue under very heay loads