pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ian Barwick <barwick@gmail.com>
To: Scott Marlowe <scott.marlowe@gmail.com>
Cc: bijayant4u@yahoo.com
Cc: tv@fuzzy.cz
Cc: pgsql-performance@postgresql.org
Subject: Re: Postgresql is very slow
Date: Tue, 24 Jun 2008 18:33:10 +0900
Message-ID: <1d581afe0806240233p27f31f41h9b4b58f6db4a50c7@mail.gmail.com> (raw)
In-Reply-To: <dcc563d10806240051k23647056j36388305e1a977e1@mail.gmail.com>
References: <20229.217.77.161.17.1214229014.squirrel@sq.gransy.com>
	<569091.76971.qm@web32704.mail.mud.yahoo.com>
	<dcc563d10806240051k23647056j36388305e1a977e1@mail.gmail.com>

2008/6/24 Scott Marlowe <scott.marlowe@gmail.com>:
> On Mon, Jun 23, 2008 at 11:48 PM, bijayant kumar <bijayant4u@yahoo.com> wrote:
(...)
>> The output of EXPLAIN query;
>>
>> select * from USERS where email like '%bijayant.kumar%';
>> This simplest query tooks 10 minutes and server loads goes from 0.35 to 16.94.
>>
>> EXPLAIN select * from USERS where email like '%bijayant.kumar%';
>>                          QUERY PLAN
>> --------------------------------------------------------------
>>  Seq Scan on USERS  (cost=0.00..54091.84 rows=1 width=161)
>>   Filter: ((email)::text ~~ '%bijayant.kumar%'::text)
>> (2 rows)
>
> You're scanning ~ 54094 sequential pages to retrieve 1 row.   Note
> that explain analyze is generally a better choice, it gives more data
> useful for troubleshooting.
>
> Definitely need a vacuum full on this table, likely followed by a reindex.

This is a LIKE query with a wildcard at the start of the string to
match, reindexing won't help much.


Ian Barwick



view thread (15+ messages)  latest in thread

Message-ID: <1d581afe0806240233p27f31f41h9b4b58f6db4a50c7@mail.gmail.com>
Permalink:  ../1d581afe0806240233p27f31f41h9b4b58f6db4a50c7@mail.gmail.com/
Also on:    postgresql.org/message-id/1d581afe0806240233p27f31f41h9b4b58f6db4a50c7@mail.gmail.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: barwick@gmail.com, scott.marlowe@gmail.com, bijayant4u@yahoo.com, tv@fuzzy.cz
  Subject: Re: Postgresql is very slow
  In-Reply-To: <1d581afe0806240233p27f31f41h9b4b58f6db4a50c7@mail.gmail.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