]> granicus.if.org Git - postgresql/commitdiff
docs: adjust multi-column most-common-value statistics
authorBruce Momjian <bruce@momjian.us>
Mon, 30 Sep 2019 17:44:22 +0000 (13:44 -0400)
committerBruce Momjian <bruce@momjian.us>
Mon, 30 Sep 2019 17:44:22 +0000 (13:44 -0400)
This commit adds a mention that the order of columns specified during
multi-column most-common-value statistics is insignificant, and tries to
simplify examples.

Discussion: https://postgr.es/m/20190828162238.GA8360@momjian.us

Backpatch-through: 12

doc/src/sgml/perform.sgml
doc/src/sgml/ref/create_statistics.sgml

index 763337b0e1dd4fb44e7dad6ece8d2db4cbf5aeec..715aff63c80adefb97c3643f80b7278715349621 100644 (file)
@@ -1172,7 +1172,7 @@ WHERE tablename = 'road';
     <para>
      Here is an example of collecting functional-dependency statistics:
 <programlisting>
-CREATE STATISTICS stts (dependencies) ON zip, city FROM zipcodes;
+CREATE STATISTICS stts (dependencies) ON city, zip FROM zipcodes;
 
 ANALYZE zipcodes;
 
@@ -1262,7 +1262,7 @@ SELECT * FROM zipcodes WHERE city = 'San Francisco' AND zip = '90210';
      Continuing the previous example, the n-distinct counts in a
      table of ZIP codes might look like the following:
 <programlisting>
-CREATE STATISTICS stts2 (ndistinct) ON zip, state, city FROM zipcodes;
+CREATE STATISTICS stts2 (ndistinct) ON city, state, zip FROM zipcodes;
 
 ANALYZE zipcodes;
 
@@ -1317,7 +1317,7 @@ nd | {"1, 2": 33178, "1, 5": 33178, "2, 5": 27435, "1, 2, 5": 33178}
      a function is required for inspection of MCV contents):
 
 <programlisting>
-CREATE STATISTICS stts3 (mcv) ON state, city FROM zipcodes;
+CREATE STATISTICS stts3 (mcv) ON city, state FROM zipcodes;
 
 ANALYZE zipcodes;
 
index ec23a154d68560ca4da04e3c9f466d2eb1c38485..5b583aacb4336123d678f1263efc8b6ddf22beb6 100644 (file)
@@ -98,7 +98,8 @@ CREATE STATISTICS [ IF NOT EXISTS ] <replaceable class="parameter">statistics_na
     <listitem>
      <para>
       The name of a table column to be covered by the computed statistics.
-      At least two column names must be given.
+      At least two column names must be given;  the order of the column names
+      is insignificant.
      </para>
     </listitem>
    </varlistentry>