Basic question about indexes (6.5.2)

From: "Alain TESIO" <tesio(at)easynet(dot)fr>
To: <pgsql-general(at)postgreSQL(dot)org>
Subject: Basic question about indexes (6.5.2)
Date: 1999-11-16 00:16:32
Message-ID: 008501bf2fc8$323ebbc0$f65f72c3@atesio
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

create table T1 ( x int );
create table T2 ( y int );
< insert from 1 to 1000 in T1 and T2>
create index idx_t1 on T1 ( x );
create index idx_t2 on T2 ( y );
explain select T1.x from T1,T2 where T1.x=T2.y;
drop table T1;
drop table T2;

Hash Join (cost=155.00 rows=1001 width=8)
-> Seq Scan on t2 (cost=43.00 rows=1000 width=4)
-> Hash (cost=43.00 rows=1000 width=4)
-> Seq Scan on t1 (cost=43.00 rows=1000 width=4)

I'm surprised that this simple query can't use indexes, or
it does and it's not reported in the explain output ?

By the way, with these tables, why does this query return
1000 and not 1000000 ?

select count(*) from T1,T2;

count
-----
1000
(1 row)

Alain

In response to

  • RPM 6.5.3 at 1999-11-14 23:08:29 from Alain TESIO

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alain TESIO 1999-11-16 00:20:52 Using functions with indexes
Previous Message Slavica Stefic 1999-11-15 23:16:26 Re: [GENERAL] vacuum analyze works on tables, but not on entire database