pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: Tarabas (Manuel Rorarius) <tarabas@tarabas.de>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-performance@postgresql.org
Subject: Re: [bulk] Re: Problem with LIKE-Performance
Date: Tue, 18 Apr 2006 17:25:43 +0100
Message-ID: <44451307.2080706@archonet.com> (raw)
In-Reply-To: <492687293.20060418180434@tarabas.de>
References: <341367953.20060418163513@tarabas.de>
	<13458.1145373620@sss.pgh.pa.us>
	<653249740.20060418173459@tarabas.de>
	<13754.1145375139@sss.pgh.pa.us>
	<492687293.20060418180434@tarabas.de>

Tarabas (Manuel Rorarius) wrote:
> Hi Tom,
> 
> TL> As already noted, it might be worth your while to add an index using the
> TL> pattern-ops opclass to help with queries like this.
> 
> I have done that now and it works very fine as supposed.
> 
> The problem with the high startup_costs disappeared somehow after the
> change of the enable_seqscan = off and a restart of pg-admin.

I'm not sure restarting pgAdmin would have had any effect.

> first Time I ran the statement it showed 13 sec execution time.
> 
> Seq Scan on image image0_  (cost=0.00..21414.21 rows=11 width=1311)
> (actual time=10504.138..12857.127 rows=119 loops=1)
>   Filter: ((title)::text ~~ '%Davorka%'::text)
> Total runtime: 12857.372 ms
> 
> second time I ran the statement it dropped to ~500 msec , which is
> pretty ok. :-)

This will be because all the data is cached in the server's memory.

> Seq Scan on image image0_  (cost=0.00..21414.21 rows=11 width=1311)
> (actual time=270.289..552.144 rows=119 loops=1)
>   Filter: ((title)::text ~~ '%Davorka%'::text)
> Total runtime: 552.708 ms

As you can see, the plan is still scanning all the rows. In any case, 
you've changed the query - this has % at the beginning and end, which no 
index will help you with.

-- 
   Richard Huxton
   Archonet Ltd



view thread (13+ messages)  latest in thread

Message-ID: <44451307.2080706@archonet.com>
Permalink:  ../44451307.2080706@archonet.com/
Also on:    postgresql.org/message-id/44451307.2080706@archonet.com

 · 

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: dev@archonet.com, tarabas@tarabas.de, tgl@sss.pgh.pa.us
  Subject: Re: [bulk] Re: Problem with LIKE-Performance
  In-Reply-To: <44451307.2080706@archonet.com>

* 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