Re: PostgreSQL 12.3 slow index scan chosen
| От | Tom Lane | 
|---|---|
| Тема | Re: PostgreSQL 12.3 slow index scan chosen | 
| Дата | |
| Msg-id | 1757512.1592600355@sss.pgh.pa.us обсуждение исходный текст | 
| Ответ на | Re: PostgreSQL 12.3 slow index scan chosen (Kenneth Marshall <ktm@rice.edu>) | 
| Ответы | Re: PostgreSQL 12.3 slow index scan chosen | 
| Список | pgsql-performance | 
Kenneth Marshall <ktm@rice.edu> writes:
> On Fri, Jun 19, 2020 at 04:11:10PM -0400, Tom Lane wrote:
>> The reason for such an estimation error usually is that the maximum
>> join key values recorded in pg_stats are off: the join side that is
>> going to be exhausted is the one with the smaller max join key.
>> "articles" seems to be small enough that the stats for it will be
>> exact, so your problem is a poor estimate of the max value of
>> objectcustomfieldvalues.objectid.  You might try raising the statistics
>> target for that table.  Or maybe it's just that ANALYZE hasn't been
>> done lately on one table or the other?
> Thank you for the information and suggestion. I tried bumping the statistics for the
> objectcustomfieldvalues.objectid column to 2k, 5k and 10k followed by an analyze and
> the query plan stayed the same. I also analyzed the article table
> repeatedly and their was no change in the plan. The table articles only has 151 rows
> while the objectcustomfieldvalues table has 19031909 rows. Any idea
> about why it is so far off?
What's the actual maximum value of objectcustomfieldvalues.objectid,
and how does that compare to the endpoint value in the pg_stats
histogram for that column?  If you've got one outlier in the table,
it might get missed by ANALYZE.
            regards, tom lane
		
	В списке pgsql-performance по дате отправления: