Index Scanning

From: Enrico <scotty(at)linuxtime(dot)it>
To: pgsql-general(at)postgresql(dot)org
Subject: Index Scanning
Date: 2007-01-03 11:41:10
Message-ID: 20070103124110.1a8b5247.scotty@linuxtime.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi, I have this query

select TB.id_int,TR.codice_art,importo,cod_iva,prezzo,qta as qta
from bolle_carico_testata TB inner join tmp_righe_bolle_carico TR on (TB.id_bolla_rem=TR.id_bolla_rem);

and these are indexes on tables.

# \d tmp_righe_bolle_carico
Indexes:
"tmpidx1" btree (id_bolla_rem)

gepv=# \d bolle_carico_testata
"idxbct4" btree (id_bolla_rem)

My query plan is:

QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------------
Hash Join (cost=7.17..888.67 rows=22420 width=67) (actual time=1.059..118.090 rows=22420 loops=1)
Hash Cond: (tr.id_bolla_rem = tb.id_bolla_rem)
-> Seq Scan on tmp_righe_bolle_carico tr (cost=0.00..545.20 rows=22420 width=67) (actual time=0.030..32.963 rows=22420 loops=1)
-> Hash (cost=6.54..6.54 rows=254 width=16) (actual time=0.980..0.980 rows=254 loops=1)
-> Seq Scan on bolle_carico_testata tb (cost=0.00..6.54 rows=254 width=16) (actual time=0.025..0.500 rows=254 loops=1)
Total runtime: 141.864 ms
(6 rows)

Can anybody tell me why I have two Seq scans instead of two Ind. scan?
And how can I do to have two ind. scan?

Thanks in advantage.

Enrico

--
If Bill Gates had a penny for everytime Windows crashed,he'd be a multi-billionaire by now .......oh look, he already is !!!!
scotty(at)linuxtime(dot)it - Skype:sscotty71
http://www.linuxtime.it/enricopirozzi

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ron Johnson 2007-01-03 12:10:32 Re: queueing via database table?
Previous Message Luca Ferrari 2007-01-03 11:24:12 database design and refactoring