X-Original-To: pgsql-admin@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 885F2475DDB for ; Tue, 4 Mar 2003 01:52:22 -0500 (EST) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with SMTP id 88299-09 for ; Tue, 4 Mar 2003 01:52:17 -0500 (EST) Received: from lucidindia.net (unknown [61.11.73.194]) by postgresql.org (Postfix) with ESMTP id 5A29F475DDA for ; Tue, 4 Mar 2003 01:52:14 -0500 (EST) Received: from a4005 ([192.168.1.18]) by lucidindia.net (8.11.6/8.11.6) with SMTP id h246q8C23894 for ; Tue, 4 Mar 2003 06:52:10 GMT Message-ID: <008601c2e21a$92b1d430$1201a8c0@a4005> From: "shreedhar" To: "Postgres" Subject: Can Any body discuss details of this Query Plan Date: Tue, 4 Mar 2003 12:22:04 +0530 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 X-Virus-Scanned: by amavisd-new X-Archive-Number: 200303/26 X-Sequence-Number: 7674 pmdummy=# explain SELECT projectid FROM tblPermissions pmdummy-# INNER JOIN tempaccountid ON tempaccountid.accid = tblPermissions. countid pmdummy-# WHERE tblPermissions.topid = 3915; 1. tempaccountid (accid integer) no indexe or no primary key Number of Records 10 2. tblPermissions (accountid integer, raccountid integer, topid integer) primary key(accountid, raccountid) Number of Records appoximately 70,0000 Before indexing on tblpermissions (topid) i got query plan as NOTICE: QUERY PLAN: Hash Join (cost=22.51..47.83 rows=25 width=12) -> Seq Scan on tempaccountid (cost=0.00..20.00 rows=1000 width=4) -> Hash (cost=22.50..22.50 rows=5 width=8) -> Seq Scan on tblpermissions (cost=0.00..22.50 rows=5 width=8) EXPLAIN After indexing on tblpermissions (topid) i got query plan as NOTICE: QUERY PLAN: Merge Join (cost=1345.76..1375.89 rows=2126 width=12) -> Sort (cost=1275.93..1275.93 rows=425 width=8) -> Index Scan using idx_tblpermissions_topid on tblpermissions (cost=0 .00..1257.37 rows=425 width=8) -> Sort (cost=69.83..69.83 rows=1000 width=4) -> Seq Scan on tempaccountid (cost=0.00..20.00 rows=1000 width=4) EXPLAIN But I could not under stand this statistics. Can any body explain above. Thanks to all seniors and gurus, Sreedhar "Faith, faith, faith in ourselves, faith, faith in God, this is the secret of greatness. If you have faith in all the three hundred and thirty millions of your mythological gods, and in all the gods which foreigners have now and again introduced into your midst, and still have no faith in yourselves, there is no salvation for you. " (III. 190)