X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5C87B53761 for ; Sat, 9 Apr 2005 16:46:52 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 16566-01 for ; Sat, 9 Apr 2005 15:46:48 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id A26EB53374 for ; Sat, 9 Apr 2005 16:46:47 +0100 (BST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j39FjN52022292; Sat, 9 Apr 2005 11:45:23 -0400 (EDT) To: "Jim C. Nasby" Cc: Alvaro Herrera , Josh Berkus , Michael Fuhr , pgsql-performance@postgresql.org Subject: Re: Functionscan estimates In-reply-to: <20050409152257.GG93835@decibel.org> References: <200504081515.50340.josh@agliodbs.com> <20050408223820.GA17450@winnie.fuhr.org> <20050408224556.GC19458@dcc.uchile.cl> <200504081604.27845.josh@agliodbs.com> <20050408235731.GA6279@dcc.uchile.cl> <19038.1113019256@sss.pgh.pa.us> <20050409152257.GG93835@decibel.org> Comments: In-reply-to "Jim C. Nasby" message dated "Sat, 09 Apr 2005 10:22:57 -0500" Date: Sat, 09 Apr 2005 11:45:23 -0400 Message-ID: <22291.1113061523@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/189 X-Sequence-Number: 11586 "Jim C. Nasby" writes: > On Sat, Apr 09, 2005 at 12:00:56AM -0400, Tom Lane wrote: >> But with all due respect to Joe, I think the reason that stuff got >> trimmed is that it didn't work very well. In most cases it's >> *hard* to write an estimator for a SRF. Let's see you produce >> one for dblink() for instance ... > Actually, if the remote database supported a way to get a rows estimate > from the query passed to db_link, it would be trivial, since you'd just > pass that back. This assumes that (1) you have the complete query argument at the time of estimation, and (2) it's OK to contact the remote database and do an EXPLAIN at that time. Both of these seem pretty shaky assumptions. The larger point is that writing an estimator for an SRF is frequently a task about as difficult as writing the SRF itself, and sometimes much *more* difficult due to lack of information. I don't foresee a whole lot of use of an estimator hook designed as proposed here. In particular, if the API is such that we can only use the estimator when all the function arguments are plan-time constants, it's not going to be very helpful. regards, tom lane