Re: Wrong plan sequential scan instead of an index one
| От | Richard Huxton |
|---|---|
| Тема | Re: Wrong plan sequential scan instead of an index one |
| Дата | |
| Msg-id | 460CDCDC.7020901@archonet.com обсуждение исходный текст |
| Ответ на | Wrong plan sequential scan instead of an index one (Gaetano Mendola <mendola@bigfoot.com>) |
| Ответы |
Re: Wrong plan sequential scan instead of an index one
|
| Список | pgsql-performance |
Gaetano Mendola wrote:
> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
>
> Hi all, take a look at those plans:
>
>
> test=# explain analyze SELECT COUNT(id) FROM t_oa_2_00_card WHERE
> pvcp in (select id from l_pvcp where value ilike '%pi%');
> -> Hash IN Join (cost=2.22..153835.49 rows=177404 width=8) (actual
> time=2.908..4001.814 rows=7801 loops=1) Hash Cond: ("outer".pvcp =
> "inner".id)
> Isn't too much choose a sequential scan due to 19 estimated rows when
> with 4 estimated does a correct index scan ?
I don't think it's the matches on l_pvcp that's the problem, it's the
fact that it thinks its getting 177404 rows matching the IN.
Now, why 19 rows from the subquery should produce such a large estimate
in the outer query I'm not sure. Any strange distribution of values on pvcp?
--
Richard Huxton
Archonet Ltd
В списке pgsql-performance по дате отправления: