Re: ORDER BY ... LIMIT and JOIN

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Fizu <Fizu(at)advancedsl(dot)com(dot)ar>
Cc: Michael Andreen <harv(at)ruin(dot)nu>, pgsql-performance(at)postgresql(dot)org
Subject: Re: ORDER BY ... LIMIT and JOIN
Date: 2009-08-10 01:30:38
Message-ID: 603c8f070908091830o69cc4889ua37ccc7dc2b1ab04@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Sun, Aug 9, 2009 at 3:26 PM, Fizu<Fizu(at)advancedsl(dot)com(dot)ar> wrote:
>               ->  Index Scan using country_ranking_user_idx on "user"
>  (cost=0.00..4807.25 rows=1710 width=143) (actual
> time=20.923..4898.931 rows=1972 loops=1)
>                     Index Cond: (country_id = 5)

An index scan that picks up 1972 rows is taking 5 seconds? I think
there must be something wrong with this index. Is it possible that
since you apparently weren't analyzing this database, that maybe you
didn't vacuum it either? If so, you should probably do a VACUUM FULL
on your database and then a database-wide REINDEX, but at a minimum
you should try reindexing this particular index.

...Robert

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Ip Wing Kin John 2009-08-10 06:22:00 Re: Bottleneck?
Previous Message Michael Andreen 2009-08-09 23:03:57 Re: ORDER BY ... LIMIT and JOIN