X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 4141CD1B4FC for ; Fri, 26 Sep 2003 04:29:28 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 16722-03 for ; Fri, 26 Sep 2003 01:28:57 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 2C1DBD1B519 for ; Fri, 26 Sep 2003 01:28:56 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.10/8.12.10) with ESMTP id h8Q4Ss6c008487; Fri, 26 Sep 2003 00:28:54 -0400 (EDT) To: Oleg Lebedev Cc: Jenny Zhang , "pgsql-performance@postgresql.org" Subject: Re: TPC-R benchmarks In-reply-to: <993DBE5B4D02194382EC8DF8554A52731D75DC@postoffice.waterford.org> References: <993DBE5B4D02194382EC8DF8554A52731D75DC@postoffice.waterford.org> Comments: In-reply-to Oleg Lebedev message dated "Thu, 25 Sep 2003 15:39:51 -0600" Date: Fri, 26 Sep 2003 00:28:54 -0400 Message-ID: <8486.1064550534@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/328 X-Sequence-Number: 3694 Oleg Lebedev writes: > Seems like in your case postgres uses an i_l_partkey index on lineitem > table. I have a foreign key constraint defined between the lineitem and > part table, but didn't create an special indexes. Here is my query plan: The planner is obviously unhappy with this plan (note the large cost numbers), but it can't find a way to do better. An index on lineitem.l_partkey would help, I think. The whole query seems like it's written in a very inefficient fashion; couldn't the estimation of '0.2 * avg(l_quantity)' be amortized across multiple join rows? But I dunno whether the TPC rules allow for significant manual rewriting of the given query. regards, tom lane