Received: from kosh.pintoo.com (kosh.pollcities.com [202.186.13.219]) by hub.org (8.10.1/8.10.1) with ESMTP id e5S5T2146177 for ; Wed, 28 Jun 2000 01:29:02 -0400 (EDT) Received: (from angch@localhost) by kosh.pintoo.com (8.9.3/8.9.3) id NAA29865 for pgsql-sql@postgresql.org; Wed, 28 Jun 2000 13:24:11 +0800 Date: Wed, 28 Jun 2000 13:24:11 +0800 From: Ang Chin Han To: pgsql-sql@postgresql.org Subject: Hash Join not using hashed index? Message-ID: <20000628132411.B29825@pollcities.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0.1i X-Archive-Number: 200006/249 I'm using Postgresql 7.02. ====================================================================== # explain select city.name, country.name from country, city where city.country_id = country.country_id; NOTICE: QUERY PLAN: Hash Join (cost=8.85..16.76 rows=75 width=18) -> Seq Scan on city (cost=0.00..1.75 rows=75 width=16) -> Hash (cost=5.53..5.53 rows=253 width=2) -> Seq Scan on country (cost=0.00..5.53 rows=253 width=2) EXPLAIN # create index country_id_idx on country using hash (country_id); CREATE # vacuum analyze; VACUUM # explain select city.name, country.name from country, city where city.country_id = country.country_id; NOTICE: QUERY PLAN: Hash Join (cost=8.85..16.76 rows=75 width=18) -> Seq Scan on city (cost=0.00..1.75 rows=75 width=16) -> Hash (cost=5.53..5.53 rows=253 width=2) -> Seq Scan on country (cost=0.00..5.53 rows=253 width=2) EXPLAIN ====================================================================== Why doesn't PostgreSQL use country_id_idx, but rather rehashing country_id?