Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 558F5F07918 for ; Wed, 27 Jun 2012 00:49:19 -0300 (ADT) Received: from tama50.ecl.ntt.co.jp ([129.60.39.147]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SjjFk-0007j7-Jv for pgsql-hackers@postgresql.org; Wed, 27 Jun 2012 03:49:18 +0000 Received: from mfs6.rdh.ecl.ntt.co.jp (mfs6.rdh.ecl.ntt.co.jp [129.60.39.149]) by tama50.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id q5R3muKW024995; Wed, 27 Jun 2012 12:48:56 +0900 Received: from mfs6.rdh.ecl.ntt.co.jp (localhost [127.0.0.1]) by mfs6.rdh.ecl.ntt.co.jp (Postfix) with ESMTP id 1D7F46B86; Wed, 27 Jun 2012 12:48:56 +0900 (JST) Received: from dmailsv1.y.ecl.ntt.co.jp (dmailsv1.y.ecl.ntt.co.jp [129.60.53.14]) by mfs6.rdh.ecl.ntt.co.jp (Postfix) with ESMTP id E1F126A40; Wed, 27 Jun 2012 12:48:55 +0900 (JST) Received: from mailsv11.y.ecl.ntt.co.jp by dmailsv1.y.ecl.ntt.co.jp (8.14.5/dmailsv1-2.1) with ESMTP id q5R3mt5v014229; Wed, 27 Jun 2012 12:48:55 +0900 (JST) Received: from localhost by mailsv11.y.ecl.ntt.co.jp (8.14.5/Lab-1.9) with ESMTP id q5R3mt3p012795; Wed, 27 Jun 2012 12:48:55 +0900 (JST) From: "Etsuro Fujita" To: "'Robert Haas'" Cc: "'Ants Aasma'" , "'Jay Levitt'" , "'Tom Lane'" , "'PostgreSQL-development'" , "'Francois Deliege'" References: <22709.1332944158@sss.pgh.pa.us> <4F766454.9040909@gmail.com> <4.3.2-J.20120615194845.03a6fa20@129.60.53.11> <004a01cd4dff$bffd9a40$3ff8cec0$@lab.ntt.co.jp> In-Reply-To: Subject: Re: [PATCH] Lazy hashaggregate when no aggregation is needed Date: Wed, 27 Jun 2012 12:53:40 +0900 Message-ID: <003e01cd5418$706dba40$51492ec0$@lab.ntt.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQFW5RmpuYBQ1Q1EBonax2VVtvN1QQHJ2D4OAp/TGtACUg7+gAJCiNmTAtG+D6UBAUClRQI2ULBxA0s/DkEB62i7xZdYdJGw Content-Language: ja X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201206/1602 X-Sequence-Number: 210442 Hi, > -----Original Message----- > From: Robert Haas [mailto:robertmhaas@gmail.com] > Sent: Wednesday, June 27, 2012 5:09 AM > To: Etsuro Fujita > Cc: Ants Aasma; Jay Levitt; Tom Lane; PostgreSQL-development; Francois = Deliege > Subject: Re: [HACKERS] [PATCH] Lazy hashaggregate when no aggregation = is needed >=20 > On Fri, Jun 22, 2012 at 10:12 AM, Robert Haas = wrote: > > On Tue, Jun 19, 2012 at 5:41 AM, Etsuro Fujita > > wrote: > >>> I'm confused by this remark, because surely the query planner does = it this > >>> way only if there's no LIMIT. =A0When there is a LIMIT, we choose = based on > >>> the startup cost plus the estimated fraction of the total cost we = expect > >>> to pay based on dividing the LIMIT by the overall row count = estimate. =A0Or > >>> is this not what you're talking about? > >> > >> I think that Ants is pointing the way of estimating costs in > >> choose_hashed_grouping()/choose_hashed_distinct(), ie cost_agg() = for > >> cheapest_path + hashagg, where the costs are calculated based on = the total > >> cost only of cheapest_path. =A0I think that it might be good to do = cost_agg() > >> for the discussed case with the AGG_SORTED strategy, not the = AGG_HASHED > >> strategy. > > > > Well, Ants already made some adjustments to those functions; not = sure > > if this means they need some more adjustment, but I don't see that > > there's a general problem with the costing algorithm around LIMIT. >=20 > Ants, do you intend to update this patch for this CommitFest? Or at > all? It seems nobody's too excited about this, so I'm not sure > whether it makes sense for you to put more work on it. But please > advise as to your plans. Please excuse my slow response, I would also like to know your plan. Best regards, Etsuro Fujita > Thanks, >=20 > -- > Robert Haas > EnterpriseDB: http://www.enterprisedb.com > The Enterprise PostgreSQL Company >=20