Hi Robert, On Thu, Mar 7, 2024 at 10:49 PM Robert Treat <r...@xzilla.net> wrote:
> This patch adds a link to the "attach partition" command section > (similar to the detach partition link above it) as well as a link to > "create table like" as both commands contain additional information > that users should review beyond what is laid out in this section. > There's also a couple of wordsmiths in nearby areas to improve > readability. > Thanks. The patch gives error when building html ddl.sgml:4300: element link: validity error : No declaration for attribute linked of element link <link linked="sql-createtable-parms-like"><literal>CREATE TABLE ... LIKE</l ^ ddl.sgml:4300: element link: validity error : Element link does not carry attribute linkend nked="sql-createtable-parms-like"><literal>CREATE TABLE ... LIKE</literal></link ^ make[1]: *** [Makefile:72: postgres-full.xml] Error 4 make[1]: *** Deleting file 'postgres-full.xml' make[1]: Leaving directory '/home/ashutosh/work/units/pg_review/coderoot/pg/doc/src/sgml' make: *** [Makefile:8: html] Error 2 I have fixed in the attached. - As an alternative, it is sometimes more convenient to create the - new table outside the partition structure, and attach it as a + As an alternative, it is sometimes more convenient to create a + new table outside of the partition structure, and attach it as a it uses article "the" for "new table" since it's referring to the partition mentioned in the earlier example. I don't think using "a" is correct. "outside" seems better than "outside of". See https://english.stackexchange.com/questions/9700/outside-or-outside-of. But I think the meaning of the sentence will be more clear if we rephrase it as in the attached patch. - convenient, as not only will the existing partitions become indexed, but - also any partitions that are created in the future will. One limitation is + convenient as not only will the existing partitions become indexed, but + any partitions created in the future will as well. One limitation is I am finding the current construct hard to read. The comma is misplaced as you have pointed out. The pair of commas break the "not only" ... "but also" construct. I have tried to simplify the sentence in the attached. Please review. - the partitioned table; such an index is marked invalid, and the partitions - do not get the index applied automatically. The indexes on partitions can - be created individually using <literal>CONCURRENTLY</literal>, and then + the partitioned table; such an index is marked invalid and the partitions + do not get the index applied automatically. The partition indexes can "indexes on partition" is clearer than "partition index". Fixed in the attached patch. Please review. -- Best Wishes, Ashutosh Bapat
diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 8616a8e9cc..043717136c 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -4283,18 +4283,20 @@ CREATE TABLE measurement_y2008m02 PARTITION OF measurement TABLESPACE fasttablespace; </programlisting> - As an alternative, it is sometimes more convenient to create the - new table outside the partition structure, and attach it as a - partition later. This allows new data to be loaded, checked, and - transformed prior to it appearing in the partitioned table. - Moreover, the <literal>ATTACH PARTITION</literal> operation requires - only <literal>SHARE UPDATE EXCLUSIVE</literal> lock on the - partitioned table, as opposed to the <literal>ACCESS - EXCLUSIVE</literal> lock that is required by <command>CREATE TABLE - ... PARTITION OF</command>, so it is more friendly to concurrent - operations on the partitioned table. - The <literal>CREATE TABLE ... LIKE</literal> option is helpful - to avoid tediously repeating the parent table's definition: + As an alternative, it is sometimes more convenient to create the partition + as a standalone new table, and attach it to the partitioned table later. + This allows new data to be loaded, checked, and transformed prior to it + appearing in the partitioned table. Moreover, the <literal>ATTACH + PARTITION</literal> operation requires only <literal>SHARE UPDATE + EXCLUSIVE</literal> lock on the partitioned table, as opposed to the + <literal>ACCESS EXCLUSIVE</literal> lock that is required by + <command>CREATE TABLE ... PARTITION OF</command>, so it is more friendly + to concurrent operations on the partitioned table; see <link + linkend="sql-altertable-attach-partition"><literal>ALTER TABLE ... ATTACH + PARTITION</literal></link> for additional details. The <link + linkend="sql-createtable-parms-like"><literal>CREATE TABLE ... + LIKE</literal></link> command can be helpful to avoid tediously repeating + the parent table's definition, for example: <programlisting> CREATE TABLE measurement_y2008m02 @@ -4345,16 +4347,14 @@ ALTER TABLE measurement ATTACH PARTITION measurement_y2008m02 <para> As explained above, it is possible to create indexes on partitioned tables - so that they are applied automatically to the entire hierarchy. - This is very - convenient, as not only will the existing partitions become indexed, but - also any partitions that are created in the future will. One limitation is + so that they are applied automatically to the entire hierarchy. The operation of creating an index on a partitioned table also creates corresponding indexes on its partitions. Any new partition created in future also inherits the indexes on the partitioned table. + One limitation is that it's not possible to use the <literal>CONCURRENTLY</literal> qualifier when creating such a partitioned index. To avoid long lock times, it is possible to use <command>CREATE INDEX ON ONLY</command> - the partitioned table; such an index is marked invalid, and the partitions + the partitioned table; such an index is marked invalid and the partitions do not get the index applied automatically. The indexes on partitions can - be created individually using <literal>CONCURRENTLY</literal>, and then + then be created individually using <literal>CONCURRENTLY</literal> and <firstterm>attached</firstterm> to the index on the parent using <command>ALTER INDEX .. ATTACH PARTITION</command>. Once indexes for all partitions are attached to the parent index, the parent index is marked