Re: Assistance with optimizing query - same SQL, different category_id = Seq Scan

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, May 08, 2006 at 07:29:32PM -0600, Brendan Duddridge wrote:
> Do you have any suggestions on how I can optimize the query so both  
> versions of the query come back fast without doing a sequential scan  
> on the price table?

Well, before you do anything you should verify that an index scan in the
second case would actually be faster. Set enable_seqscan=off and check
that.

After that, you can favor an index scan by (in order of effectiveness)
increasing the correlation on the appropriate index (by clustering on
it), lowering random_page_cost, or increasing effective_cache_size.
-- 
Jim C. Nasby, Sr. Engineering Consultant      jnasby@xxxxxxxxxxxxx
Pervasive Software      http://pervasive.com    work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf       cell: 512-569-9461


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux