Re: Full text search with ORDER BY performance issue

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Krade" <krade(at)krade(dot)com>,<pgsql-performance(at)postgresql(dot)org>
Subject: Re: Full text search with ORDER BY performance issue
Date: 2009-07-20 21:42:31
Message-ID: 4A649E7702000025000289E3@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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

Have you considered keeping rows "narrow" until you've identified your
24 rows? Something like:

SELECT * FROM a
WHERE id in
(
SELECT id FROM a
WHERE comment_tsv @@ plainto_tsquery('love')
ORDER BY timestamp DESC
LIMIT 24 OFFSET 0
)
ORDER BY timestamp DESC
;

-Kevin

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Raji Sridar (raji) 2009-07-20 22:33:04 Help needed for reading postgres log : RE: Concurrency issue under very heay loads
Previous Message Merlin Moncure 2009-07-20 21:24:57 Re: Fastest char datatype