Yannick Le Guédart <yannick 'at' over-blog.com> writes:
> Greetings,
>
> I was trying to get informations on #portgresql about a query plan I
> think is quite strange, and I was said to post on this list. I hope my
> mail will be clear enough. I have included the query, the query plan,
> and the table definitions. I just don't understand the "Seq Scan" on
> fileds that are indexed.
This is a FAQ entry (curious that the people there didn't direct
you to the FAQ first):
http://www.postgresql.org/docs/faqs.FAQ.html#item4.6
It's possible that more than 800,000 rows is not a "small
percentage of the rows in the table", and also there's the fact
that "indexes are normally not used (..) to perform joins".
Also, your database may not be analyzed, or not properly tuned
(for example, it seems that the default random_page_cost of 4 is
too large for current disks - at least for us, we've found that 2
is more correct)
[...]
> -> Seq Scan on _user (cost=0.00..205537.72 rows=806972 width=24)
--
Guillaume Cottenceau, MNC Mobile News Channel SA, an Alcatel-Lucent Company
Av. de la Gare 10, 1003 Lausanne, Switzerland - direct +41 21 317 50 36