Re: ordering of 'where' sub clauses - Mailing list pgsql-general

From Steve Heaven
Subject Re: ordering of 'where' sub clauses
Date
Msg-id 3.0.1.32.20000718084859.006c56f0@mail.thornet.co.uk
Whole thread Raw
In response to Postmaster response  ("Sean Alphonse" <salphonse1@home.com>)
Responses Re: ordering of 'where' sub clauses  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: ordering of 'where' sub clauses  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
List pgsql-general
At 11:44 17/07/00 -0700, Stephan Szabo wrote:
>First off, is that query really what you want?
>main.* is probably adding an extra join with main (see the explain output --
>it appears to be doing two joins against main, one as m and one as main).
>
>Try the query as
>select m.* from main m, subset_table s where m.stockno=s.stockno and
>m.descrip ~ 'SEARCHTERM';
>
>and see what it gives you then.
>

Its different, but it still does the 'wrong' scan first and even stranger
now it doesnt do an indexed scan on subset_table:

 explain select m.* from main m, subset_table s
 where m.stockno=s.stockno AND m.descrip ~ 'SEARCHTERM';
NOTICE:  QUERY PLAN:

Hash Join  (cost=118431.88 rows=714797 width=172)
  ->  Seq Scan on main m  (cost=79300.27 rows=714796 width=160)
  ->  Hash  (cost=8121.17 rows=203793 width=12)
        ->  Seq Scan on subset_table s  (cost=8121.17 rows=203793 width=12)


I'm confused !
Steve

--
thorNET  - Internet Consultancy, Services & Training
Phone: 01454 854413
Fax:   01454 854412
http://www.thornet.co.uk

pgsql-general by date:

Previous
From: Denis Perchine
Date:
Subject: Re: Quoting routines in libpq
Next
From: AVU Makerere
Date:
Subject: Postgresql and Postmaster response