X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 711179DC9AD for ; Wed, 22 Feb 2006 15:13:37 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 65088-08 for ; Wed, 22 Feb 2006 15:13:37 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from exchange.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 5FD189DC99D for ; Wed, 22 Feb 2006 15:13:35 -0400 (AST) Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; Wed, 22 Feb 2006 19:13:36 +0000 Received: from state.g2switchworks.com by mail.g2switchworks.com; 22 Feb 2006 13:13:36 -0600 Subject: Re: Joins and full index scans...mysql vs postgres? From: Scott Marlowe To: ryan groth Cc: "Steinar H. Gunderson" , pgsql-performance@postgresql.org In-Reply-To: References: Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1140635616.5777.35.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Wed, 22 Feb 2006 13:13:36 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.156 required=5 tests=[AWL=0.155, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.156 X-Spam-Level: X-Archive-Number: 200602/354 X-Sequence-Number: 17340 On Wed, 2006-02-22 at 12:11, ryan groth wrote: > Does this work: > > "Merge Left Join (cost=0.00..2656.36 rows=6528 width=1522) (actual > time=0.057..123.659 rows=6528 loops=1)" > " Merge Cond: ("outer".uid = "inner".uid)" > " -> Merge Left Join (cost=0.00..1693.09 rows=6528 width=1264) > (actual time=0.030..58.876 rows=6528 loops=1)" > " Merge Cond: ("outer".uid = "inner".user_id)" > " -> Index Scan using users_pkey on users (cost=0.00..763.81 > rows=6528 width=100) (actual time=0.016..9.446 rows=6528 loops=1)" > " -> Index Scan using phorum_users_base_pkey on > phorum_users_base (cost=0.00..822.92 rows=9902 width=1168) (actual > time=0.007..15.674 rows=9845 loops=1)" > " -> Index Scan using useraux_pkey on useraux (cost=0.00..846.40 > rows=7582 width=262) (actual time=0.007..11.935 rows=7529 loops=1)" > "Total runtime: 127.442 ms" In MySQL, have you tried writing a short perl or php script or even timing the mysql client running in one shot mode (I assume it can do that) from the outside to see how long it takes to actually run the query AND retrieve the data? My guess is most of the time for both queries will be taken in delivering the data.