Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id AF7431337B4F for ; Thu, 30 Sep 2010 03:27:07 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 10866-10 for ; Thu, 30 Sep 2010 06:27:00 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from exprod7og126.obsmtp.com (exprod7og126.obsmtp.com [64.18.2.206]) by mail.postgresql.org (Postfix) with SMTP id AEAD71337B4E for ; Thu, 30 Sep 2010 03:26:59 -0300 (ADT) Received: from source ([209.85.215.53]) by exprod7ob126.postini.com ([64.18.6.12]) with SMTP ID DSNKTKQtsjzsXji7s3PgPcLUHqC2SYhvXH6u@postini.com; Wed, 29 Sep 2010 23:27:00 PDT Received: by ewy3 with SMTP id 3so648212ewy.26 for ; Wed, 29 Sep 2010 23:26:58 -0700 (PDT) Received: by 10.14.37.7 with SMTP id x7mr1688808eea.3.1285828018034; Wed, 29 Sep 2010 23:26:58 -0700 (PDT) Received: from [192.168.1.183] (dsl-hkibrasgw2-ff7ac300-240.dhcp.inet.fi [88.195.122.240]) by mx.google.com with ESMTPS id a48sm13909850eei.18.2010.09.29.23.26.56 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 29 Sep 2010 23:26:56 -0700 (PDT) Message-ID: <4CA42DAE.8000701@enterprisedb.com> Date: Thu, 30 Sep 2010 09:26:54 +0300 From: Heikki Linnakangas User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; fi-FI; rv:1.9.1.12) Gecko/20100913 Icedove/3.0.7 MIME-Version: 1.0 To: Itagaki Takahiro CC: Alvaro Herrera , Robert Haas , SAKAMOTO Masahiko , Heikki Linnakangas , pgsql-hackers Subject: Re: patch: SQL/MED(FDW) DDL References: <4C905DB0.6040302@oss.ntt.co.jp> <4C934741.4070102@oss.ntt.co.jp> <4C9C6B86.3040102@enterprisedb.com> <4CA03EBA.4010203@oss.ntt.co.jp> <1285768919-sup-3750@alvh.no-ip.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-4.2 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3 X-Spam-Level: X-Archive-Number: 201009/2114 X-Sequence-Number: 170978 On 30.09.2010 04:30, Itagaki Takahiro wrote: > On Wed, Sep 29, 2010 at 11:09 PM, Alvaro Herrera > wrote: >> I'm not sure that it's a good idea to embed into the FDW API the set of >> operations known to the executor. For example your proposal fails to >> consider bitmap scans. Seems simpler and more general to hand the quals >> over saying "I need to scan this relation with these quals", and have it >> return an opaque iterable object; > > Agreed. If possible, we will avoid dedicated interfaces for seqscans and > index scans. However, bitmap scan is difficult anyway because foreign tables > might not have ctid columns. It's a challenging task to identify individual > tuples in foreign tables. It will be also used for UPDATE and DELETE. > >> There doesn't to be much point in knowing the names of remote indexes >> either (if it came to referencing them, better use OIDs) > > FYI, HiRDB, that implements FDW routines, has CREATE FOREIGN INDEX. > I think it is a little ugly and won't work in some cases -- for example, > index organized tables -- but evidently it's a realistic solution. A long time ago I used DB2's federated database feature, which is at least close to SQL/MED if not fully compatible. When you create a "federated index" there. it's just a planner hint to the local database, so that it knows how expensive it is to evaluate a qual remotely vs. locally. It shouldn't matter what technology the remote index uses in that case, as long as the cost model is roughly the same as a b-tree. I don't think we want to go down that path though, it's better to leave the cost estimation altogether to the wrapper. It has much better knowledge of expensive various quals are. However, the wrapper will likely need some local storage for indexes and like to do the cost estimation. Or maybe it can just keep the information in cache, loading it on first use from the remote database. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com