Re: browsing table with 2 million records - Mailing list pgsql-performance

From aurora
Subject Re: browsing table with 2 million records
Date
Msg-id cbd177510510261422h17f277d3w92c834164cf75a4e@mail.gmail.com
Whole thread Raw
In response to Re: browsing table with 2 million records  (Mark Lewis <mark.lewis@mir3.com>)
Responses Re: browsing table with 2 million records  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-performance
>>   select * from table order by date limit 25 offset 0

> Do you have an index on the date column?  Can you post an EXPLAIN
> ANALYZE for the slow query?

Wow! Now that I look again there are actually 2 date fields. One is indexed and one is not. Order by was done on the column without index. Using the indexed column turn a seq scan into index scan and the query performance is totally fine now.

It would still be helpful if select count(*) can perform well.

Thanks!

Wy

pgsql-performance by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: browsing table with 2 million records
Next
From: Alex Turner
Date:
Subject: Re: browsing table with 2 million records