From: Dominique Vallée <dominique.vallee@mnhn.fr>
To: pgsql-performance@postgresql.org
Subject: query faster with a foreign table
Date: Thu, 26 Mar 2015 11:46:55 +0100
Message-ID: <5513E39F.2070503@mnhn.fr> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: dominique.vallee@mnhn.fr
Subject: Re: query faster with a foreign table
In-Reply-To: <5513E39F.2070503@mnhn.fr>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox