Re: select query takes 13 seconds to run with index

From: Justin <justin(at)emproshunts(dot)com>
To: mark <markkicks(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: select query takes 13 seconds to run with index
Date: 2008-05-26 23:26:33
Message-ID: 483B4729.7050402@emproshunts.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-performance

mark wrote:
> Hi, is there anyway this can be made faster? id is the primary key,
> and there is an index on uid..
>
> thanks
>
>
> EXPLAIN ANALYZE select * from pokes where uid = 578439028 order by id
> DESC limit 6;
> QUERY PLAN
> ----------------------------------------------------------------------------------------------------------------------------------------------------
> Limit (cost=0.00..9329.02 rows=6 width=135) (actual
> time=13612.247..13612.247 rows=0 loops=1)
> -> Index Scan Backward using pokes_pkey on pokes
> (cost=0.00..5182270.69 rows=3333 width=135) (actual
> time=13612.245..13612.245 rows=0 loops=1)
> Filter: (uid = 578439028)
> Total runtime: 13612.369 ms
> (4 rows)
>
>
First this should be posted on performance list.

how many records are in this table? The uid 578,439,028 assuming this
is auto incremented key that started 1 this means there is 578 million
records in the table.

The estimate is way off, when was the last time Vaccum was on the table?

What verison of Postgresql are you running
Size of the Table
Table layout
Load on the database

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message mark 2008-05-26 23:32:50 Re: select query takes 13 seconds to run with index
Previous Message mark 2008-05-26 22:49:35 select query takes 13 seconds to run with index

Browse pgsql-performance by date

  From Date Subject
Next Message mark 2008-05-26 23:32:50 Re: select query takes 13 seconds to run with index
Previous Message mark 2008-05-26 22:49:35 select query takes 13 seconds to run with index