Thread: Seq Scan

Seq Scan

From
Linh Luong
Date:
Hi,

I am trying to execute this query I wrote and it is not returning at a
reasonable time to the browser.  I took the query and ran EXPLAIN on it
and it displayed that every JOIN I do it is doing a Seq Scan on it.  I
have indexes on that table but it doesn't seem to use it.

Is there a way I can ensure that postgres will use my indexes?

Thanks again

-- 
Linh Luong
Computalog Ltd.
Software Developer
Phone: (780) 464-6686 (ext 325)
Email: linh.luong@computalog.com


Re: Seq Scan

From
Martín Marqués
Date:
On Lun 28 May 2001 19:24, Linh Luong wrote:
> Hi,
>
> I am trying to execute this query I wrote and it is not returning at a
> reasonable time to the browser.  I took the query and ran EXPLAIN on it
> and it displayed that every JOIN I do it is doing a Seq Scan on it.  I
> have indexes on that table but it doesn't seem to use it.
>
> Is there a way I can ensure that postgres will use my indexes?

When Postgres doesn´t use indexes, it´s because sequencial scans are faster 
(I think the normal case would be a table with not so much rows).
AFAIK, the planer is who does this, and it uses internal data which was 
gathered during a VACUUM analyze.

So I would do a VACUUM analyze and the re-run the EXPLAIN to see what it 
shows.

Saludos... :-)

-- 
Cualquiera administra un NT.
Ese es el problema, que cualquiera administre.
-----------------------------------------------------------------
Martin Marques                  |        mmarques@unl.edu.ar
Programador, Administrador      |       Centro de Telematica                      Universidad Nacional
        del Litoral
 
-----------------------------------------------------------------