RE : Seq scan of table? - Mailing list pgsql-general

From Bruno BAGUETTE
Subject RE : Seq scan of table?
Date
Msg-id !~!UENERkVCMDkAAQACAAAAAAAAAAAAAAAAABgAAAAAAAAATBuXKOMvlkWzD3KJN6FWLMKAAAAQAAAAFjfXWJYWwkSSEWAGOI+R0gEAAAAA@baguette.net
Whole thread Raw
In response to Seq scan of table?  ("Bjorn T Johansen" <btj@havleik.no>)
List pgsql-general
Hello,

> I am trying to tune my database and I discovered one select
> that does a seq scan on a table but I can't see why... All
> the join fields are indexed and I am returning just one
> record, so no sort is done. Does it just pick seq scan for
> the heck of it or is it a reason?

Are the join fields both of the exactly same type ? If no (eg : INT2 and
INT4)
you must cast in order to have the same type.

If the join fields are not of the same type, PostgreSQL will do a seq
scan.

I had exactly the same problem and learned here that tip :-)

Hope this help,

---------------------------------------
Bruno BAGUETTE - pgsql-ml@baguette.net



pgsql-general by date:

Previous
From: "Bjorn T Johansen"
Date:
Subject: Seq scan of table?
Next
From: Tom Lane
Date:
Subject: Re: SQL Error: pqReadData() -- read() failed: errno=0 No error