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 376B4D1B4EC for ; Wed, 1 Oct 2003 22:25:51 +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 28824-09 for ; Wed, 1 Oct 2003 19:25:07 -0300 (ADT) Received: from davinci.ethosmedia.com (unknown [209.128.84.228]) by svr1.postgresql.org (Postfix) with ESMTP id 11ACED1B4E1 for ; Wed, 1 Oct 2003 19:25:04 -0300 (ADT) Received: from [66.219.92.2] (HELO temoku) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3704793; Wed, 01 Oct 2003 15:25:38 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: Oleg Lebedev , "scott.marlowe" Subject: Re: TPC-R benchmarks Date: Wed, 1 Oct 2003 15:23:12 -0700 User-Agent: KMail/1.4.3 Cc: "pgsql-performance@postgresql.org" References: <993DBE5B4D02194382EC8DF8554A52731D761E@postoffice.waterford.org> In-Reply-To: <993DBE5B4D02194382EC8DF8554A52731D761E@postoffice.waterford.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200310011523.12895.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/41 X-Sequence-Number: 3789 Oleg, > All right, my query just finished running with EXPLAIN ANALYZE. > I show the plan below and also attached it as a file. > Any ideas? Yes. Your problem appears to be right here: > -> Nested Loop > (cost=3D0.00..54596.00 rows=3D3 width=3D88) (actual time=3D482.41..663060= 1.46 > rows=3D348760 loops=3D1) > Join Filter: > ("inner".s_suppkey =3D "outer".l_suppkey) > -> Nested Loop > (cost=3D0.00..54586.18 rows=3D3 width=3D80) (actual time=3D383.87..659498= 4.40 > rows=3D348760 loops=3D1) > -> Nested Loop > (cost=3D0.00..54575.47 rows=3D4 width=3D68) (actual time=3D199.95..358088= 2.07 > rows=3D348760 loops=3D1) > Join Filter: > ("outer".p_partkey =3D "inner".ps_partkey) > -> Nested Loop > (cost=3D0.00..22753.33 rows=3D9343 width=3D49) (actual time=3D146.85..354= 1433.10 > rows=3D348760 loops=3D1) For some reason, the row estimate on the supplier --> lineitem join is bad,= as=20 is the estimate on part --> partsupp. Let me first check two things: 1) You have an index on l_suppkey and on ps_partkey. 2) you have run ANALYZE on your whole database before the query If both of those are true, I'd like to see the lines in pg_stats that apply= to=20 ps_partkey and l_suppkey; please do a: SELECT * FROM pg_stats WHERE attname =3D 'l_suppkey' or attname =3D 'ps_par= tkey' --=20 -Josh Berkus Aglio Database Solutions San Francisco