Re: [PERFORM] reducing random_page_cost from 4 to 2 to force index scan

2011-04-27 Thread Sok Ann Yap
On Wed, Apr 27, 2011 at 8:40 PM, Kevin Grittner wrote: > Sok Ann Yap  wrote: >> Kevin Grittner  wrote: > >>> Please show us your overall configuration and give a description >>> of the hardware (how many of what kind of cores, how much RAM, >>> what s

Re: [PERFORM] reducing random_page_cost from 4 to 2 to force index scan

2011-04-27 Thread Sok Ann Yap
On Thu, Apr 28, 2011 at 7:23 AM, Kevin Grittner wrote: > Sok Ann Yap wrote: > >> Anyway, the overhead of spawning 44 extra queries means that it is >> still better off for me to stick with the original query and tune >> PostgreSQL to choose index scan. > > Maybe, bu

Re: [PERFORM] reducing random_page_cost from 4 to 2 to force index scan

2011-04-27 Thread Sok Ann Yap
On Wed, Apr 27, 2011 at 5:37 AM, Kevin Grittner wrote: > Sok Ann Yap wrote: > >> So, index scan wins by a very small margin over sequential scan >> after the tuning. I am a bit puzzled because index scan is more >> than 3000 times faster in this case, but the estimate

[PERFORM] reducing random_page_cost from 4 to 2 to force index scan

2011-04-26 Thread Sok Ann Yap
Hi, I am using PostgreSQL 9.0. There is a salutations table with 44 rows, and a contacts table with more than a million rows. The contacts table has a nullable (only 0.002% null) salutation_id column, referencing salutations.id. With this query: SELECT salutations.id, salutations.name,