pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: jesper@krogh.cc
To: pgsql-performance@postgresql.org
Subject: Slow query-plan generation (fast query) PG 9.2
Date: Tue, 3 Sep 2013 09:46:02 +0200 (CEST)
Message-ID: <e9ed24069c06d8b504fbef3e28df52d7.squirrel@shrek.krogh.cc> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>

Hi.

I have a strange situation where generating the query plan takes 6s+ and
executing it takes very little time.

2013-09-03 09:19:38.726 db=# explain select table.id  from db.table left
join db.tablepro on db.id = tablepro.table_id where table.fts @@
to_tsquery('english','q12345') ;
                                                    QUERY PLAN
-------------------------------------------------------------------------------------------------------------------
 Nested Loop Left Join  (cost=43.71..12711.39 rows=2930 width=4)
   ->  Bitmap Heap Scan on sequence  (cost=43.71..4449.10 rows=2930 width=4)
         Recheck Cond: (fts @@ '''q12345'''::tsquery)
         ->  Bitmap Index Scan on table_gin_idx  (cost=0.00..42.98
rows=2930 width=0)
               Index Cond: (fts @@ '''q12345'''::tsquery)
   ->  Index Only Scan using tablepro_seqid_idx on tablepro 
(cost=0.00..2.81 rows=1 width=4)
         Index Cond: (tablepro_id = table.id)
(7 rows)

Time: 10458.404 ms


The query gives 4 rows out of 50.000.000, so the query-plan is actually
correct and as expected.

Any suggestions?

Jesper




-- 
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance



view thread (4+ messages)  latest in thread

Message-ID: <e9ed24069c06d8b504fbef3e28df52d7.squirrel@shrek.krogh.cc>
Permalink:  ../e9ed24069c06d8b504fbef3e28df52d7.squirrel@shrek.krogh.cc/
Also on:    postgresql.org/message-id/e9ed24069c06d8b504fbef3e28df52d7.squirrel@shrek.krogh.cc

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: jesper@krogh.cc
  Subject: Re: Slow query-plan generation (fast query) PG 9.2
  In-Reply-To: <e9ed24069c06d8b504fbef3e28df52d7.squirrel@shrek.krogh.cc>
  References: <e9ed24069c06d8b504fbef3e28df52d7.squirrel@shrek.krogh.cc>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox