Received: from sss.pgh.pa.us ([192.204.191.242]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f6KH5Ua01564 for ; Fri, 20 Jul 2001 13:05:30 -0400 (EDT) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id f6KH5GC04088; Fri, 20 Jul 2001 13:05:16 -0400 (EDT) To: "David M. Richter" cc: pgsql-sql@postgresql.org Subject: Re: Query optimizing - paradox behave In-reply-to: <3B57F09E.C807E20A@freenet.de> References: <3B57F09E.C807E20A@freenet.de> Comments: In-reply-to "David M. Richter" message dated "Fri, 20 Jul 2001 10:49:34 +0200" Date: Fri, 20 Jul 2001 13:05:16 -0400 Message-ID: <4085.995648716@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200107/278 X-Sequence-Number: 4081 "David M. Richter" writes: > The query with the 3 tables is faster than the query with 2 tables. How you figure that? > time psql -d compare -c "SELECT patient.*,study.* FROM > patient,study,relpatient_study000 r0 WHERE > (patient.chiliOID=r0.parentOID AND study.chiliOID=r0.childOID) order by > patient.name using <" > 3tableni > 1.671u 0.130s 0:11.14 16.4% 0+0k 0+0io 208pf+0w > time psql -d pacs -c "SELECT patient.*,study.* FROM patient,study WHERE > (patient.chiliOID=study.patientOID ) order by patient.name using <" > > 2tableni > 1.730u 0.120s 0:09.44 19.5% 0+0k 0+0io 208pf+0w 9.44 vs 11.14 seconds looks like a clear advantage for the second query to me... regards, tom lane