pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: bill_martin@freenet.de
To: pgsql-performance@postgresql.org
Subject: Planner selects different execution plans depending on limit
Date: Mon, 10 Sep 2012 16:24:30 +0200
Message-ID: <ccf45defbe1241e741631192a29f1c09@email.freenet.de> (raw)

Hi All

I´ve  ft_simple_core_content_content_idx
  ON core_content
  USING gin
  (to_tsvector('simple'::regconfig, content) );

  
If I´m seaching for a word which is NOT in the column content the query plan and the execution time differs with the given limit.
If I choose 3927 or any higher number the query execution took only few milliseconds. 
  
 core_content content where
to_tsvector('simple', content.content) @@ tsquery(plainto_tsquery('simple', 'asdasdadas') :: varchar || ':*')=true
Limit 3927

"Limit  (cost=0.00..19302.23 rows=3926 width=621) (actual time=52147.149..52147.149 rows=0 loops=1)"
"  ->  Seq Scan on core_content content  (cost=0.00..98384.34 rows=20011 width=621) (actual time=52147.147..52147.147 rows=0 loops=1)"
"        Filter: (to_tsvector('simple'::regconfig, content) @@ '''asdasdadas'':*'::tsquery)"
"Total runtime: 52147.173 ms"

Is there any posibility to improve the performance even if the limit is only 10? Is it possible to determine that the query optimizer takes only the fast bitmap heap scan instead of the slow seq scan?

Regards,
Bill Martin


---
E-Mail ist da wo du bist! Jetzt mit freenetMail ganz bequem auch unterwegs E-Mails verschicken.
Am besten gleich informieren unter http://mail.freenet.de/mobile-email/index.html

view thread (15+ messages)  latest in thread

Message-ID: <ccf45defbe1241e741631192a29f1c09@email.freenet.de>
Permalink:  ../ccf45defbe1241e741631192a29f1c09@email.freenet.de/
Also on:    postgresql.org/message-id/ccf45defbe1241e741631192a29f1c09@email.freenet.de

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: bill_martin@freenet.de
  Subject: Re: Planner selects different execution plans depending on limit
  In-Reply-To: <ccf45defbe1241e741631192a29f1c09@email.freenet.de>

* 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