Re: Weirdly pesimistic estimates in optimizer
От | Robert Haas |
---|---|
Тема | Re: Weirdly pesimistic estimates in optimizer |
Дата | |
Msg-id | CA+TgmoZ1yBU_EkSn-DFjb7kxBiknrd+FOnzBvkN8R+nTdCv1WA@mail.gmail.com обсуждение исходный текст |
Ответ на | Weirdly pesimistic estimates in optimizer (David Kubečka <kubecka.dav@gmail.com>) |
Список | pgsql-hackers |
On Mon, Mar 2, 2015 at 2:19 PM, David Kubečka <kubecka.dav@gmail.com> wrote: > The question is why optimizer, or rather the cost estimator, produced so > much different estimates upon very small change in input. Moreover it seems > that the main culprit of bad estimates isn't actually directly related to > outer table, but rather to inner table. Just compare estimates for the two > index scans: > > With 'random_fk_dupl': > -> Index Scan using facts_fk_idx on facts (cost=0.42..5.75 > rows=100 width=15) (actual time=0.009..0.117 rows=98 loops=100) > With 'random_fk_uniq': > -> Index Scan using facts_fk_idx on facts (cost=0.42..214.26 > rows=100 width=15) (actual time=0.007..0.109 rows=98 loops=100) Whoa. That's pretty dramatic. Am I correctly understanding that the two tables contain *exactly* the same data? Could the issue be that the optimizer thinks that one of the tables is thought to have a higher logical-to-physical correlation than the other (see pg_stats.correlation)? -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
В списке pgsql-hackers по дате отправления: