Re: Sequence Scan vs. Index scan

From: "Mikael Carneholm" <Mikael(dot)Carneholm(at)WirelessCar(dot)com>
To: "Fernando Lujan" <fernando(dot)lujan(at)mandic(dot)com(dot)br>, <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Sequence Scan vs. Index scan
Date: 2006-03-21 18:22:43
Message-ID: 7F10D26ECFA1FB458B89C5B4B0D72C2B0A02AC@sesrv12.wirelesscar.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Assuming you are joining on "Table 1".id = "Table 2".id - do you have indexes on both columns? Have you analyzed your tables + indexes (are there statistics available?) If not those criterias are met, it is unlikely that postgres will choose an index scan.

-----Original Message-----
From: pgsql-performance-owner(at)postgresql(dot)org
[mailto:pgsql-performance-owner(at)postgresql(dot)org]On Behalf Of Fernando
Lujan
Sent: den 21 mars 2006 19:08
To: pgsql-performance(at)postgresql(dot)org
Subject: [PERFORM] Sequence Scan vs. Index scan

Hi guys,

I'm trying to figure out when Sequence Scan is better than Index Scan. I
just want to know this because I disabled the sequence scan in
postgresql and receive a better result. :)

Two tables.

Table 1 (1 million rows )
-----------
id
text
table2_id

Table 2 (300 thousand rows)
----------
id
text 2

When I join these two tables I have a sequence_scan. :(

Thanks in advance.

Fernando Lujan

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Browse pgsql-performance by date

  From Date Subject
Next Message Reimer 2006-03-21 18:23:08 Re: Sequence Scan vs. Index scan
Previous Message Steinar H. Gunderson 2006-03-21 18:17:32 Re: Sequence Scan vs. Index scan