Re: R: Query plan on identical tables differs . Why ? - Mailing list pgsql-performance

From Tom Lane
Subject Re: R: Query plan on identical tables differs . Why ?
Date
Msg-id 8904.1084460460@sss.pgh.pa.us
Whole thread Raw
In response to R: Query plan on identical tables differs . Why ?  ("Fabio Panizzutti" <panizzutti@interlogica.net>)
Responses R: R: Query plan on identical tables differs . Why ?
List pgsql-performance
"Fabio Panizzutti" <panizzutti@interlogica.net> writes:
> I don't understand why the planner chose a different query plan on
> identical tables with same indexes .

Different data statistics; not to mention different table sizes
(the cost equations are not linear).

Have you ANALYZEd (or VACUUM ANALYZEd) both tables recently?

If the stats are up to date but still not doing the right thing,
you might try increasing the statistics target for the larger
table's tag_id column.  See ALTER TABLE SET STATISTICS.

            regards, tom lane

pgsql-performance by date:

Previous
From: Mark Kirkwood
Date:
Subject: Re: Clarification on some settings
Next
From: Stephan Szabo
Date:
Subject: Re: R: Query plan on identical tables differs . Why ?