Re: Query slow for new participants - Mailing list pgsql-performance

From Michael Lewis
Subject Re: Query slow for new participants
Date
Msg-id CAHOFxGrhyXmGe_bgY_oO5du_Qt7S0aDDAvxR2znYeawNAPEk-g@mail.gmail.com
Whole thread Raw
In response to Re: Query slow for new participants  ("support@mekong.be" <support@mekong.be>)
Responses Re: Query slow for new participants
List pgsql-performance

Indexes:
    "pk_pricedb" PRIMARY KEY, btree (companyid, articleid)
    "EnabledIndex" btree (enabled)
    "ix_companyarticledb_article" btree (articleid)
    "ix_companyarticledb_company" btree (companyid)

I'd say drop ix_companyarticledb_company since pk_pricedb can be used instead even if other queries are only on companyid field, and it will be faster for this case certainly since it targets the row you want directly from the index without the "Rows Removed by Filter: 2674361"

I doubt the default_statistics_target = 100 default is doing you any favors. You may want to try increasing that to 500 or 1000 if you can afford a small increase in planning cost and more storage for the bigger sampling of stats.

pgsql-performance by date:

Previous
From: Jeff Janes
Date:
Subject: Re: Aggregate and many LEFT JOIN
Next
From: "support@mekong.be"
Date:
Subject: Re: Query slow for new participants