Re: postgres_fdw: IMPORT FOREIGN SCHEMA ... LIMIT TO (partition) - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: postgres_fdw: IMPORT FOREIGN SCHEMA ... LIMIT TO (partition)
Date
Msg-id c50fbeab-0d3f-39b9-2573-707638ef26ec@oss.nttdata.com
Whole thread Raw
In response to Re: postgres_fdw: IMPORT FOREIGN SCHEMA ... LIMIT TO (partition)  (Bernd Helmle <mailings@oopsware.de>)
Responses Re: postgres_fdw: IMPORT FOREIGN SCHEMA ... LIMIT TO (partition)  (Amit Langote <amitlangote09@gmail.com>)
List pgsql-hackers

On 2021/03/29 2:39, Bernd Helmle wrote:
> Am Mittwoch, dem 24.03.2021 um 17:32 +0100 schrieb Bernd Helmle:
>>> Yes, but it should be noted that the main reason that was mentioned
>>> as
>>> a reason to exclude partitions is to not cause table catalog bloat,
>>> and I argue that this argument is not as solid in the case of the
>>> explicitly named tables of the LIMIT TO clause. Except if SQL
>>> standard
>>> prescribes otherwise, I think allowing partitions in LIMIT TO
>>> clauses
>>> is an improvement overall.
>>
>> Don't get me wrong, i find this useful, too. Especially because it's
>> a
>> very minor change in the code. And i don't see negative aspects here
>> currently, either (which doesn't mean there aren't some).
> 
> Since there are currently no obvious objections i've marked this "Read
> for Committer".

For now I have no objection to this feature.

-IMPORT FOREIGN SCHEMA import_source EXCEPT (t1, "x 4", nonesuch)
+IMPORT FOREIGN SCHEMA import_source EXCEPT (t1, "x 4", nonesuch, t4_part)

Isn't it better to create also another partition like "t4_part2"?
If we do this, for example, the above test can confirm that both
partitions in EXCEPT and not in are excluded.

+    All tables or foreign tables which are partitions of some other table
+    are automatically excluded from <xref linkend="sql-importforeignschema"/>
+    unless they are explicitly included in the <literal>LIMIT TO</literal>

IMO it's better to document that partitions are imported when they are
included in LIMIT TO, instead. What about the following?

     Tables or foreign tables which are partitions of some other table are
     imported only when they are explicitly specified in
     <literal>LIMIT TO</literal> clause.  Otherwise they are automatically
     excluded from <xref linkend="sql-importforeignschema"/>.

+    clause.  Since all data can be accessed through the partitioned table
+    which is the root of the partitioning hierarchy, this approach should
+    allow access to all the data without creating extra objects.

Now "this approach" in the above is not clear? What about replacing it with
something like "importing only partitioned tables"?

Regards,

-- 
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION



pgsql-hackers by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: New IndexAM API controlling index vacuum strategies
Next
From: Peter Geoghegan
Date:
Subject: Re: New IndexAM API controlling index vacuum strategies