Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Yb5JX-0001tK-3x for pgsql-performance@arkaria.postgresql.org; Thu, 26 Mar 2015 10:47:03 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Yb5JV-0000Jy-UD for pgsql-performance@arkaria.postgresql.org; Thu, 26 Mar 2015 10:47:01 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Yb5JU-0000Jp-R2 for pgsql-performance@postgresql.org; Thu, 26 Mar 2015 10:47:00 +0000 Received: from dsigwsmtp1.mnhn.fr ([192.134.151.201]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Yb5JQ-0006lb-QH for pgsql-performance@postgresql.org; Thu, 26 Mar 2015 10:46:59 +0000 Received: from localhost (localhost [127.0.0.1]) by dsigwsmtp1.mnhn.fr (Postfix) with ESMTP id 6D73C232294 for ; Thu, 26 Mar 2015 11:46:56 +0100 (CET) X-Virus-Scanned: amavisd-new at mnhn.fr Received: from dsigwsmtp1.mnhn.fr ([127.0.0.1]) by localhost (dsigwsmtp.mnhn.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pxKRjfIS7BvO for ; Thu, 26 Mar 2015 11:46:56 +0100 (CET) Received: from dsiwebmail.mnhn.fr (dsiwebmail.mnhn.fr [192.134.151.200]) by dsigwsmtp1.mnhn.fr (Postfix) with ESMTP id 468E6232293 for ; Thu, 26 Mar 2015 11:46:56 +0100 (CET) Received: from smtp.mnhn.fr (smtpinterne.mnhn.fr [192.134.151.199]) by dsiwebmail.mnhn.fr (Postfix) with ESMTP id 40766A2A50 for ; Thu, 26 Mar 2015 11:46:56 +0100 (CET) Received: from [10.8.49.191] (egb303dv.mnhn.fr [10.8.49.191]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.mnhn.fr (Postfix) with ESMTPS id 36A563FFCE for ; Thu, 26 Mar 2015 11:46:56 +0100 (CET) Message-ID: <5513E39F.2070503@mnhn.fr> Date: Thu, 26 Mar 2015 11:46:55 +0100 From: =?UTF-8?B?RG9taW5pcXVlIFZhbGzDqWU=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: query faster with a foreign table Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org Hello, I have an executing time problem for a query : this time is very different as I used a local table or a foreign table : 20 times faster for the foreign table On a server 9.4.1, I have 2 spatial bases b1 (size 5.4 Go) et b2 (size 19Mo) and in the base b1 the table tmp_obs_coordgps (61 Mo, 502982 lignes). When I use a JOIN construct beetwen this table tmp_obs_coordgps and a foreign table fao_areas (table in b2), the performance are best than with a local table fao_aires_local (in b1). These 2 tables fao_areas and fao_aires_local are identical (build with "select * from" or with pg_dump : the results are the same) The links to "explain analyze" are * foreign table fao_areas : http://explain.depesz.com/s/4hO select count(*) from tmp_obs_coordgps o, fao_areas f where o.code_fao=f.f_code and st_contains(f.the_geom, o.geom); * local table fao_aires_local : http://explain.depesz.com/s/BvDb select count(*) from tmp_obs_coordgps o, fao_aires_local f where o.code_fao=f.f_code and st_contains(f.the_geom, o.geom); Thanks by advance -- Dominique Vallée UMS 3468 Bases de données sur la Biodiversité, Ecologie, Environnement et Sociétés (BBEES) MNHN - Muséum national d'Histoire naturelle 01 40 79 53 70 -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance