4 * No.16-1 export_plain_stats.sql.sample
8 DELETE FROM dbms_stats._column_stats_locked;
9 DELETE FROM dbms_stats._relation_stats_locked;
10 SELECT dbms_stats.lock_database_stats();
31 UPDATE dbms_stats._relation_stats_locked
32 SET (relpages, reltuples, relallvisible, curpages) = (0,0,0,0);
33 UPDATE dbms_stats._column_stats_locked SET
34 stanullfrac = -staattnum,
35 stawidth = -staattnum,
36 stadistinct = -staattnum,
47 stanumbers1 = ARRAY[-staattnum,22],
48 stanumbers2 = ARRAY[-staattnum,23],
49 stanumbers3 = ARRAY[-staattnum,24],
50 stanumbers4 = ARRAY[-staattnum,21],
51 stanumbers5 = ARRAY[-staattnum,25],
52 stavalues1 = stavalues3,
53 stavalues2 = stavalues2,
54 stavalues3 = stavalues1,
55 stavalues4 = stavalues4,
56 stavalues5 = stavalues5;
57 \i export_plain_stats.sql.sample
59 * If you want the statistics of per-relation or per-column, please modify
60 * nspname, relname, and attname in 'WHERE' clause.
62 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
64 * If you want to chage the output file name, please modify the following name.
67 COPY (SELECT n2.nspname,
72 (pg_relation_size(c.oid) / current_setting('block_size')::int4)::int4
74 pg_catalog.pg_stat_get_last_analyze_time(c.oid)
76 pg_catalog.pg_stat_get_last_autoanalyze_time(c.oid)
78 COALESCE(a.attname, ''),
79 n1.nspname AS schemaname_of_atttype,
108 ON (s.starelid = a.attrelid AND s.staattnum = a.attnum)
110 ON a.atttypid = t.oid
112 ON t.typnamespace = n1.oid
113 RIGHT JOIN pg_catalog.pg_class c
114 ON s.starelid = c.oid
115 JOIN pg_catalog.pg_namespace n2
116 ON c.relnamespace = n2.oid
117 WHERE c.relkind IN ('r', 'i', 'f')
118 AND NOT n2.nspname IN ('pg_catalog',
120 'information_schema',
122 -- AND n2.nspname = 'public'
123 -- AND c.relname = 'test'
124 -- AND a.attname = 'id'
125 ORDER BY starelid, staattnum)
130 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
131 SELECT * FROM work_v;
132 nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5
133 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+------------------------+-------------+-------------+-------------+-------------+------------------+------------+------------+------------+------------
134 public | pt0 | 0 | 0 | 0 | 0 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
135 public | pt0_idx | 2 | 0 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
136 public | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2} | (null) | (null) | (null) | (null)
137 public | st0 | 1 | 2 | 1 | 1 | name | pg_catalog | bpchar | 9 | f | 0 | 6 | -0.5 | 1 | 3 | 0 | 0 | 0 | 1054 | 1058 | 0 | 0 | 0 | {1} | {1} | (null) | (null) | (null) | {"test "} | (null) | (null) | (null) | (null)
138 public | st0_idx | 2 | 2 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
139 public | st1 | 45 | 10000 | 45 | 45 | str | pg_catalog | text | -1 | f | 0 | 2 | 3 | 1 | 3 | 0 | 0 | 0 | 98 | 664 | 0 | 0 | 0 | {0.3334,0.3333,0.3333} | {0.3332} | (null) | (null) | (null) | {1,0,2} | (null) | (null) | (null) | (null)
140 public | st1 | 45 | 10000 | 45 | 45 | val | pg_catalog | int4 | -1 | f | 0 | 4 | 3 | 1 | 3 | 0 | 0 | 0 | 96 | 97 | 0 | 0 | 0 | {0.3334,0.3333,0.3333} | {0.3332} | (null) | (null) | (null) | {1,0,2} | (null) | (null) | (null) | (null)
141 public | st1_exp | 30 | 10000 | 0 | 30 | lower | pg_catalog | text | -1 | f | 0 | 5 | 3 | 1 | 3 | 0 | 0 | 0 | 98 | 664 | 0 | 0 | 0 | {0.3334,0.3333,0.3333} | {0.3332} | (null) | (null) | (null) | {1,0,2} | (null) | (null) | (null) | (null)
142 public | st1_idx | 30 | 10000 | 0 | 30 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
143 s0 | sft0 | 0 | 0 | 0 | 0 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
144 s0 | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2} | (null) | (null) | (null) | (null)
145 s0 | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | t | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2,4,5,6} | (null) | (null) | (null) | (null)
146 s0 | st0 | 1 | 2 | 1 | 1 | num | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {10,20} | (null) | (null) | (null) | (null)
147 s0 | st0 | 1 | 2 | 1 | 1 | num | pg_catalog | int4 | -1 | t | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {10,20,40,50,60} | (null) | (null) | (null) | (null)
148 s0 | st0_idx | 2 | 2 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
149 s0 | st1 | 1 | 3 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {4,5,6} | (null) | (null) | (null) | (null)
150 s0 | st1 | 1 | 3 | 1 | 1 | num | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {40,50,60} | (null) | (null) | (null) | (null)
151 s0 | st1_idx | 2 | 3 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
152 s0 | st2 | 1 | 3 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2,3} | (null) | (null) | (null) | (null)
153 s0 | st2 | 1 | 3 | 1 | 1 | txt | pg_catalog | text | -1 | f | 0 | 5 | -1 | 2 | 3 | 0 | 0 | 0 | 664 | 664 | 0 | 0 | 0 | (null) | {0.5} | (null) | (null) | (null) | {1,comment,test} | (null) | (null) | (null) | (null)
154 s0 | st2_idx | 2 | 3 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
155 s0 | st3 | 0 | 0 | 0 | 0 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
156 s1 | st0 | 1 | 4 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2,3,4} | (null) | (null) | (null) | (null)
157 s1 | st0 | 1 | 4 | 1 | 1 | num | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {15,25,35,45} | (null) | (null) | (null) | (null)
160 TRUNCATE dbms_stats.work;
162 \! sed '/ORDER/i\\ AND n2.nspname = '"\'s0\'" export_plain_stats.sql.sample > export_plain_stats.sql.sample_test
163 \i export_plain_stats.sql.sample_test
165 * If you want the statistics of per-relation or per-column, please modify
166 * nspname, relname, and attname in 'WHERE' clause.
168 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
170 * If you want to chage the output file name, please modify the following name.
173 COPY (SELECT n2.nspname,
178 (pg_relation_size(c.oid) / current_setting('block_size')::int4)::int4
180 pg_catalog.pg_stat_get_last_analyze_time(c.oid)
182 pg_catalog.pg_stat_get_last_autoanalyze_time(c.oid)
184 COALESCE(a.attname, ''),
185 n1.nspname AS schemaname_of_atttype,
214 ON (s.starelid = a.attrelid AND s.staattnum = a.attnum)
216 ON a.atttypid = t.oid
218 ON t.typnamespace = n1.oid
219 RIGHT JOIN pg_catalog.pg_class c
220 ON s.starelid = c.oid
221 JOIN pg_catalog.pg_namespace n2
222 ON c.relnamespace = n2.oid
223 WHERE c.relkind IN ('r', 'i', 'f')
224 AND NOT n2.nspname IN ('pg_catalog',
226 'information_schema',
228 -- AND n2.nspname = 'public'
229 -- AND c.relname = 'test'
230 -- AND a.attname = 'id'
231 AND n2.nspname = 's0'
232 ORDER BY starelid, staattnum)
237 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
238 SELECT * FROM work_v;
239 nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5
240 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------------+------------+------------+------------+------------
241 s0 | sft0 | 0 | 0 | 0 | 0 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
242 s0 | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2} | (null) | (null) | (null) | (null)
243 s0 | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | t | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2,4,5,6} | (null) | (null) | (null) | (null)
244 s0 | st0 | 1 | 2 | 1 | 1 | num | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {10,20} | (null) | (null) | (null) | (null)
245 s0 | st0 | 1 | 2 | 1 | 1 | num | pg_catalog | int4 | -1 | t | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {10,20,40,50,60} | (null) | (null) | (null) | (null)
246 s0 | st0_idx | 2 | 2 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
247 s0 | st1 | 1 | 3 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {4,5,6} | (null) | (null) | (null) | (null)
248 s0 | st1 | 1 | 3 | 1 | 1 | num | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {40,50,60} | (null) | (null) | (null) | (null)
249 s0 | st1_idx | 2 | 3 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
250 s0 | st2 | 1 | 3 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2,3} | (null) | (null) | (null) | (null)
251 s0 | st2 | 1 | 3 | 1 | 1 | txt | pg_catalog | text | -1 | f | 0 | 5 | -1 | 2 | 3 | 0 | 0 | 0 | 664 | 664 | 0 | 0 | 0 | (null) | {0.5} | (null) | (null) | (null) | {1,comment,test} | (null) | (null) | (null) | (null)
252 s0 | st2_idx | 2 | 3 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
253 s0 | st3 | 0 | 0 | 0 | 0 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
256 TRUNCATE dbms_stats.work;
257 \! rm export_plain_stats.sql.sample_test
259 \! sed '/ORDER/i\\ AND c.relname = '"\'st0\'" export_plain_stats.sql.sample > export_plain_stats.sql.sample_test
260 \i export_plain_stats.sql.sample_test
262 * If you want the statistics of per-relation or per-column, please modify
263 * nspname, relname, and attname in 'WHERE' clause.
265 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
267 * If you want to chage the output file name, please modify the following name.
270 COPY (SELECT n2.nspname,
275 (pg_relation_size(c.oid) / current_setting('block_size')::int4)::int4
277 pg_catalog.pg_stat_get_last_analyze_time(c.oid)
279 pg_catalog.pg_stat_get_last_autoanalyze_time(c.oid)
281 COALESCE(a.attname, ''),
282 n1.nspname AS schemaname_of_atttype,
311 ON (s.starelid = a.attrelid AND s.staattnum = a.attnum)
313 ON a.atttypid = t.oid
315 ON t.typnamespace = n1.oid
316 RIGHT JOIN pg_catalog.pg_class c
317 ON s.starelid = c.oid
318 JOIN pg_catalog.pg_namespace n2
319 ON c.relnamespace = n2.oid
320 WHERE c.relkind IN ('r', 'i', 'f')
321 AND NOT n2.nspname IN ('pg_catalog',
323 'information_schema',
325 -- AND n2.nspname = 'public'
326 -- AND c.relname = 'test'
327 -- AND a.attname = 'id'
328 AND c.relname = 'st0'
329 ORDER BY starelid, staattnum)
334 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
335 SELECT * FROM work_v;
336 nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5
337 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------------+------------+------------+------------+------------
338 public | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2} | (null) | (null) | (null) | (null)
339 public | st0 | 1 | 2 | 1 | 1 | name | pg_catalog | bpchar | 9 | f | 0 | 6 | -0.5 | 1 | 3 | 0 | 0 | 0 | 1054 | 1058 | 0 | 0 | 0 | {1} | {1} | (null) | (null) | (null) | {"test "} | (null) | (null) | (null) | (null)
340 s0 | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2} | (null) | (null) | (null) | (null)
341 s0 | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | t | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2,4,5,6} | (null) | (null) | (null) | (null)
342 s0 | st0 | 1 | 2 | 1 | 1 | num | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {10,20} | (null) | (null) | (null) | (null)
343 s0 | st0 | 1 | 2 | 1 | 1 | num | pg_catalog | int4 | -1 | t | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {10,20,40,50,60} | (null) | (null) | (null) | (null)
344 s1 | st0 | 1 | 4 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2,3,4} | (null) | (null) | (null) | (null)
345 s1 | st0 | 1 | 4 | 1 | 1 | num | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {15,25,35,45} | (null) | (null) | (null) | (null)
348 TRUNCATE dbms_stats.work;
349 \! rm export_plain_stats.sql.sample_test
351 \! sed '/ORDER/i\\ AND c.relname = '"\'pg_toast_1262\'" export_plain_stats.sql.sample > export_plain_stats.sql.sample_test
352 \i export_plain_stats.sql.sample_test
354 * If you want the statistics of per-relation or per-column, please modify
355 * nspname, relname, and attname in 'WHERE' clause.
357 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
359 * If you want to chage the output file name, please modify the following name.
362 COPY (SELECT n2.nspname,
367 (pg_relation_size(c.oid) / current_setting('block_size')::int4)::int4
369 pg_catalog.pg_stat_get_last_analyze_time(c.oid)
371 pg_catalog.pg_stat_get_last_autoanalyze_time(c.oid)
373 COALESCE(a.attname, ''),
374 n1.nspname AS schemaname_of_atttype,
403 ON (s.starelid = a.attrelid AND s.staattnum = a.attnum)
405 ON a.atttypid = t.oid
407 ON t.typnamespace = n1.oid
408 RIGHT JOIN pg_catalog.pg_class c
409 ON s.starelid = c.oid
410 JOIN pg_catalog.pg_namespace n2
411 ON c.relnamespace = n2.oid
412 WHERE c.relkind IN ('r', 'i', 'f')
413 AND NOT n2.nspname IN ('pg_catalog',
415 'information_schema',
417 -- AND n2.nspname = 'public'
418 -- AND c.relname = 'test'
419 -- AND a.attname = 'id'
420 AND c.relname = 'pg_toast_1262'
421 ORDER BY starelid, staattnum)
426 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
427 SELECT * FROM work_v;
428 nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5
429 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------
432 TRUNCATE dbms_stats.work;
433 \! rm export_plain_stats.sql.sample_test
435 \! sed '/ORDER/i\\ AND c.relname = '"\'st0_idx\'" export_plain_stats.sql.sample > export_plain_stats.sql.sample_test
436 \i export_plain_stats.sql.sample_test
438 * If you want the statistics of per-relation or per-column, please modify
439 * nspname, relname, and attname in 'WHERE' clause.
441 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
443 * If you want to chage the output file name, please modify the following name.
446 COPY (SELECT n2.nspname,
451 (pg_relation_size(c.oid) / current_setting('block_size')::int4)::int4
453 pg_catalog.pg_stat_get_last_analyze_time(c.oid)
455 pg_catalog.pg_stat_get_last_autoanalyze_time(c.oid)
457 COALESCE(a.attname, ''),
458 n1.nspname AS schemaname_of_atttype,
487 ON (s.starelid = a.attrelid AND s.staattnum = a.attnum)
489 ON a.atttypid = t.oid
491 ON t.typnamespace = n1.oid
492 RIGHT JOIN pg_catalog.pg_class c
493 ON s.starelid = c.oid
494 JOIN pg_catalog.pg_namespace n2
495 ON c.relnamespace = n2.oid
496 WHERE c.relkind IN ('r', 'i', 'f')
497 AND NOT n2.nspname IN ('pg_catalog',
499 'information_schema',
501 -- AND n2.nspname = 'public'
502 -- AND c.relname = 'test'
503 -- AND a.attname = 'id'
504 AND c.relname = 'st0_idx'
505 ORDER BY starelid, staattnum)
510 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
511 SELECT * FROM work_v;
512 nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5
513 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------
514 public | st0_idx | 2 | 2 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
515 s0 | st0_idx | 2 | 2 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
518 TRUNCATE dbms_stats.work;
519 \! rm export_plain_stats.sql.sample_test
521 \! sed '/ORDER/i\\ AND c.relname = '"\'ss0\'" export_plain_stats.sql.sample > export_plain_stats.sql.sample_test
522 \i export_plain_stats.sql.sample_test
524 * If you want the statistics of per-relation or per-column, please modify
525 * nspname, relname, and attname in 'WHERE' clause.
527 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
529 * If you want to chage the output file name, please modify the following name.
532 COPY (SELECT n2.nspname,
537 (pg_relation_size(c.oid) / current_setting('block_size')::int4)::int4
539 pg_catalog.pg_stat_get_last_analyze_time(c.oid)
541 pg_catalog.pg_stat_get_last_autoanalyze_time(c.oid)
543 COALESCE(a.attname, ''),
544 n1.nspname AS schemaname_of_atttype,
573 ON (s.starelid = a.attrelid AND s.staattnum = a.attnum)
575 ON a.atttypid = t.oid
577 ON t.typnamespace = n1.oid
578 RIGHT JOIN pg_catalog.pg_class c
579 ON s.starelid = c.oid
580 JOIN pg_catalog.pg_namespace n2
581 ON c.relnamespace = n2.oid
582 WHERE c.relkind IN ('r', 'i', 'f')
583 AND NOT n2.nspname IN ('pg_catalog',
585 'information_schema',
587 -- AND n2.nspname = 'public'
588 -- AND c.relname = 'test'
589 -- AND a.attname = 'id'
590 AND c.relname = 'ss0'
591 ORDER BY starelid, staattnum)
596 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
597 SELECT * FROM work_v;
598 nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5
599 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------
602 TRUNCATE dbms_stats.work;
603 \! rm export_plain_stats.sql.sample_test
605 \! sed '/ORDER/i\\ AND c.relname = '"\'sc0\'" export_plain_stats.sql.sample > export_plain_stats.sql.sample_test
606 \i export_plain_stats.sql.sample_test
608 * If you want the statistics of per-relation or per-column, please modify
609 * nspname, relname, and attname in 'WHERE' clause.
611 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
613 * If you want to chage the output file name, please modify the following name.
616 COPY (SELECT n2.nspname,
621 (pg_relation_size(c.oid) / current_setting('block_size')::int4)::int4
623 pg_catalog.pg_stat_get_last_analyze_time(c.oid)
625 pg_catalog.pg_stat_get_last_autoanalyze_time(c.oid)
627 COALESCE(a.attname, ''),
628 n1.nspname AS schemaname_of_atttype,
657 ON (s.starelid = a.attrelid AND s.staattnum = a.attnum)
659 ON a.atttypid = t.oid
661 ON t.typnamespace = n1.oid
662 RIGHT JOIN pg_catalog.pg_class c
663 ON s.starelid = c.oid
664 JOIN pg_catalog.pg_namespace n2
665 ON c.relnamespace = n2.oid
666 WHERE c.relkind IN ('r', 'i', 'f')
667 AND NOT n2.nspname IN ('pg_catalog',
669 'information_schema',
671 -- AND n2.nspname = 'public'
672 -- AND c.relname = 'test'
673 -- AND a.attname = 'id'
674 AND c.relname = 'sc0'
675 ORDER BY starelid, staattnum)
680 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
681 SELECT * FROM work_v;
682 nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5
683 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------
686 TRUNCATE dbms_stats.work;
687 \! rm export_plain_stats.sql.sample_test
689 \! sed '/ORDER/i\\ AND c.relname = '"\'sft0\'" export_plain_stats.sql.sample > export_plain_stats.sql.sample_test
690 \i export_plain_stats.sql.sample_test
692 * If you want the statistics of per-relation or per-column, please modify
693 * nspname, relname, and attname in 'WHERE' clause.
695 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
697 * If you want to chage the output file name, please modify the following name.
700 COPY (SELECT n2.nspname,
705 (pg_relation_size(c.oid) / current_setting('block_size')::int4)::int4
707 pg_catalog.pg_stat_get_last_analyze_time(c.oid)
709 pg_catalog.pg_stat_get_last_autoanalyze_time(c.oid)
711 COALESCE(a.attname, ''),
712 n1.nspname AS schemaname_of_atttype,
741 ON (s.starelid = a.attrelid AND s.staattnum = a.attnum)
743 ON a.atttypid = t.oid
745 ON t.typnamespace = n1.oid
746 RIGHT JOIN pg_catalog.pg_class c
747 ON s.starelid = c.oid
748 JOIN pg_catalog.pg_namespace n2
749 ON c.relnamespace = n2.oid
750 WHERE c.relkind IN ('r', 'i', 'f')
751 AND NOT n2.nspname IN ('pg_catalog',
753 'information_schema',
755 -- AND n2.nspname = 'public'
756 -- AND c.relname = 'test'
757 -- AND a.attname = 'id'
758 AND c.relname = 'sft0'
759 ORDER BY starelid, staattnum)
764 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
765 SELECT * FROM work_v;
766 nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5
767 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------
768 s0 | sft0 | 0 | 0 | 0 | 0 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
771 TRUNCATE dbms_stats.work;
772 \! rm export_plain_stats.sql.sample_test
774 \! sed '/ORDER/i\\ AND n2.nspname = '"\'s0\'"' AND a.attname = '\'id\' export_plain_stats.sql.sample > export_plain_stats.sql.sample_test
775 \i export_plain_stats.sql.sample_test
777 * If you want the statistics of per-relation or per-column, please modify
778 * nspname, relname, and attname in 'WHERE' clause.
780 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
782 * If you want to chage the output file name, please modify the following name.
785 COPY (SELECT n2.nspname,
790 (pg_relation_size(c.oid) / current_setting('block_size')::int4)::int4
792 pg_catalog.pg_stat_get_last_analyze_time(c.oid)
794 pg_catalog.pg_stat_get_last_autoanalyze_time(c.oid)
796 COALESCE(a.attname, ''),
797 n1.nspname AS schemaname_of_atttype,
826 ON (s.starelid = a.attrelid AND s.staattnum = a.attnum)
828 ON a.atttypid = t.oid
830 ON t.typnamespace = n1.oid
831 RIGHT JOIN pg_catalog.pg_class c
832 ON s.starelid = c.oid
833 JOIN pg_catalog.pg_namespace n2
834 ON c.relnamespace = n2.oid
835 WHERE c.relkind IN ('r', 'i', 'f')
836 AND NOT n2.nspname IN ('pg_catalog',
838 'information_schema',
840 -- AND n2.nspname = 'public'
841 -- AND c.relname = 'test'
842 -- AND a.attname = 'id'
843 AND n2.nspname = 's0' AND a.attname = 'id'
844 ORDER BY starelid, staattnum)
849 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
850 SELECT * FROM work_v;
851 nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5
852 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------
853 s0 | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2} | (null) | (null) | (null) | (null)
854 s0 | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | t | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2,4,5,6} | (null) | (null) | (null) | (null)
855 s0 | st1 | 1 | 3 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {4,5,6} | (null) | (null) | (null) | (null)
856 s0 | st2 | 1 | 3 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2,3} | (null) | (null) | (null) | (null)
859 TRUNCATE dbms_stats.work;
860 \! rm export_plain_stats.sql.sample_test
862 \! sed '/ORDER/i\\ AND n2.nspname = '"\'s0\'"' AND a.attname IS NULL' export_plain_stats.sql.sample > export_plain_stats.sql.sample_test
863 \i export_plain_stats.sql.sample_test
865 * If you want the statistics of per-relation or per-column, please modify
866 * nspname, relname, and attname in 'WHERE' clause.
868 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
870 * If you want to chage the output file name, please modify the following name.
873 COPY (SELECT n2.nspname,
878 (pg_relation_size(c.oid) / current_setting('block_size')::int4)::int4
880 pg_catalog.pg_stat_get_last_analyze_time(c.oid)
882 pg_catalog.pg_stat_get_last_autoanalyze_time(c.oid)
884 COALESCE(a.attname, ''),
885 n1.nspname AS schemaname_of_atttype,
914 ON (s.starelid = a.attrelid AND s.staattnum = a.attnum)
916 ON a.atttypid = t.oid
918 ON t.typnamespace = n1.oid
919 RIGHT JOIN pg_catalog.pg_class c
920 ON s.starelid = c.oid
921 JOIN pg_catalog.pg_namespace n2
922 ON c.relnamespace = n2.oid
923 WHERE c.relkind IN ('r', 'i', 'f')
924 AND NOT n2.nspname IN ('pg_catalog',
926 'information_schema',
928 -- AND n2.nspname = 'public'
929 -- AND c.relname = 'test'
930 -- AND a.attname = 'id'
931 AND n2.nspname = 's0' AND a.attname IS NULL
932 ORDER BY starelid, staattnum)
937 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
938 SELECT * FROM work_v;
939 nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5
940 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------
941 s0 | sft0 | 0 | 0 | 0 | 0 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
942 s0 | st0_idx | 2 | 2 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
943 s0 | st1_idx | 2 | 3 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
944 s0 | st2_idx | 2 | 3 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
945 s0 | st3 | 0 | 0 | 0 | 0 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
948 TRUNCATE dbms_stats.work;
949 \! rm export_plain_stats.sql.sample_test
951 \! sed '/ORDER/i\\ AND n2.nspname = '"\'s1\'"' AND c.relname IS NULL' export_plain_stats.sql.sample > export_plain_stats.sql.sample_test
952 \i export_plain_stats.sql.sample_test
954 * If you want the statistics of per-relation or per-column, please modify
955 * nspname, relname, and attname in 'WHERE' clause.
957 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
959 * If you want to chage the output file name, please modify the following name.
962 COPY (SELECT n2.nspname,
967 (pg_relation_size(c.oid) / current_setting('block_size')::int4)::int4
969 pg_catalog.pg_stat_get_last_analyze_time(c.oid)
971 pg_catalog.pg_stat_get_last_autoanalyze_time(c.oid)
973 COALESCE(a.attname, ''),
974 n1.nspname AS schemaname_of_atttype,
1003 ON (s.starelid = a.attrelid AND s.staattnum = a.attnum)
1005 ON a.atttypid = t.oid
1006 JOIN pg_namespace n1
1007 ON t.typnamespace = n1.oid
1008 RIGHT JOIN pg_catalog.pg_class c
1009 ON s.starelid = c.oid
1010 JOIN pg_catalog.pg_namespace n2
1011 ON c.relnamespace = n2.oid
1012 WHERE c.relkind IN ('r', 'i', 'f')
1013 AND NOT n2.nspname IN ('pg_catalog',
1015 'information_schema',
1017 -- AND n2.nspname = 'public'
1018 -- AND c.relname = 'test'
1019 -- AND a.attname = 'id'
1020 AND n2.nspname = 's1' AND c.relname IS NULL
1021 ORDER BY starelid, staattnum)
1026 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
1027 SELECT * FROM work_v;
1028 nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5
1029 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------
1032 TRUNCATE dbms_stats.work;
1033 \! rm export_plain_stats.sql.sample_test
1035 * No.16-2 export_effective_stats.sql.sample
1039 SELECT dbms_stats.lock_database_stats();
1041 ---------------------
1060 UPDATE dbms_stats._relation_stats_locked
1061 SET (relpages, reltuples, relallvisible, curpages) = (NULL, NULL, NULL, NULL);
1062 UPDATE dbms_stats._column_stats_locked
1063 SET (stanullfrac, stawidth, stadistinct,
1064 stakind1, stakind2, stakind3, stakind4, stakind5,
1065 staop1, staop2, staop3, staop4, staop5,
1066 stanumbers1, stanumbers2, stanumbers3, stanumbers4, stanumbers5,
1067 stavalues1, stavalues2, stavalues3, stavalues4, stavalues5)
1068 = (NULL, NULL, NULL,
1069 NULL, NULL, NULL, NULL, NULL,
1070 NULL, NULL, NULL, NULL, NULL,
1071 NULL, NULL, NULL, NULL, NULL,
1072 NULL, NULL, NULL, NULL, NULL)
1073 WHERE starelid = 's0.st0'::regclass;
1074 \i export_effective_stats.sql.sample
1076 * If you want the statistics of per-relation or per-column, please modify
1077 * nspname, relname, and attname in 'WHERE' clause.
1079 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
1081 * If you want to chage the output file name, please modify the following name.
1084 COPY (SELECT n2.nspname,
1092 COALESCE(a.attname, ''),
1093 n1.nspname AS schemaname_of_atttype,
1120 FROM dbms_stats.column_stats_effective co
1122 ON (co.starelid = a.attrelid AND co.staattnum = a.attnum)
1124 ON a.atttypid = t.oid
1125 JOIN pg_namespace n1
1126 ON t.typnamespace = n1.oid
1127 RIGHT JOIN dbms_stats.relation_stats_effective r
1128 ON co.starelid = r.relid
1129 JOIN pg_catalog.pg_class cl
1131 JOIN pg_catalog.pg_namespace n2
1132 ON cl.relnamespace = n2.oid
1133 -- WHERE n2.nspname = 'public'
1134 -- AND cl.relname = 'test'
1135 -- AND a.attname = 'id'
1136 ORDER BY starelid, staattnum)
1141 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
1142 SELECT * FROM work_v;
1143 nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5
1144 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------------+------------+------------------+------------+------------
1145 public | pt0 | 0 | 0 | 0 | 0 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
1146 public | pt0_idx | 2 | 0 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
1147 public | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | f | -1 | -1 | -1 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | {-1,22} | {-1,23} | {-1,24} | {-1,21} | {-1,25} | (null) | (null) | {1,2} | (null) | (null)
1148 public | st0 | 1 | 2 | 1 | 1 | name | pg_catalog | bpchar | 9 | f | -2 | -2 | -2 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | {-2,22} | {-2,23} | {-2,24} | {-2,21} | {-2,25} | (null) | (null) | {"test "} | (null) | (null)
1149 public | st0_idx | 2 | 2 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
1150 public | st1 | 45 | 10000 | 45 | 45 | str | pg_catalog | text | -1 | f | -2 | -2 | -2 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | {-2,22} | {-2,23} | {-2,24} | {-2,21} | {-2,25} | (null) | (null) | {1,0,2} | (null) | (null)
1151 public | st1 | 45 | 10000 | 45 | 45 | val | pg_catalog | int4 | -1 | f | -1 | -1 | -1 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | {-1,22} | {-1,23} | {-1,24} | {-1,21} | {-1,25} | (null) | (null) | {1,0,2} | (null) | (null)
1152 public | st1_exp | 30 | 10000 | 0 | 30 | lower | pg_catalog | text | -1 | f | -1 | -1 | -1 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | {-1,22} | {-1,23} | {-1,24} | {-1,21} | {-1,25} | (null) | (null) | {1,0,2} | (null) | (null)
1153 public | st1_idx | 30 | 10000 | 0 | 30 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
1154 s0 | sft0 | 0 | 0 | 0 | 0 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
1155 s0 | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2} | (null) | (null) | (null) | (null)
1156 s0 | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | t | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2,4,5,6} | (null) | (null) | (null) | (null)
1157 s0 | st0 | 1 | 2 | 1 | 1 | num | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {10,20} | (null) | (null) | (null) | (null)
1158 s0 | st0 | 1 | 2 | 1 | 1 | num | pg_catalog | int4 | -1 | t | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {10,20,40,50,60} | (null) | (null) | (null) | (null)
1159 s0 | st0_idx | 2 | 2 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
1160 s0 | st1 | 1 | 3 | 1 | 1 | id | pg_catalog | int4 | -1 | f | -1 | -1 | -1 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | {-1,22} | {-1,23} | {-1,24} | {-1,21} | {-1,25} | (null) | (null) | {4,5,6} | (null) | (null)
1161 s0 | st1 | 1 | 3 | 1 | 1 | num | pg_catalog | int4 | -1 | f | -2 | -2 | -2 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | {-2,22} | {-2,23} | {-2,24} | {-2,21} | {-2,25} | (null) | (null) | {40,50,60} | (null) | (null)
1162 s0 | st1_idx | 2 | 3 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
1163 s0 | st2 | 1 | 3 | 1 | 1 | id | pg_catalog | int4 | -1 | f | -1 | -1 | -1 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | {-1,22} | {-1,23} | {-1,24} | {-1,21} | {-1,25} | (null) | (null) | {1,2,3} | (null) | (null)
1164 s0 | st2 | 1 | 3 | 1 | 1 | txt | pg_catalog | text | -1 | f | -2 | -2 | -2 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | {-2,22} | {-2,23} | {-2,24} | {-2,21} | {-2,25} | (null) | (null) | {1,comment,test} | (null) | (null)
1165 s0 | st2_idx | 2 | 3 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
1166 s0 | st3 | 0 | 0 | 0 | 0 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
1167 s1 | st0 | 1 | 4 | 1 | 1 | id | pg_catalog | int4 | -1 | f | -1 | -1 | -1 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | {-1,22} | {-1,23} | {-1,24} | {-1,21} | {-1,25} | (null) | (null) | {1,2,3,4} | (null) | (null)
1168 s1 | st0 | 1 | 4 | 1 | 1 | num | pg_catalog | int4 | -1 | f | -2 | -2 | -2 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | {-2,22} | {-2,23} | {-2,24} | {-2,21} | {-2,25} | (null) | (null) | {15,25,35,45} | (null) | (null)
1171 TRUNCATE dbms_stats.work;
1173 \! sed '/ORDER/i\\ WHERE n2.nspname = '"\'s0\'" export_effective_stats.sql.sample > export_effective_stats.sql.sample_test
1174 \i export_effective_stats.sql.sample_test
1176 * If you want the statistics of per-relation or per-column, please modify
1177 * nspname, relname, and attname in 'WHERE' clause.
1179 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
1181 * If you want to chage the output file name, please modify the following name.
1184 COPY (SELECT n2.nspname,
1192 COALESCE(a.attname, ''),
1193 n1.nspname AS schemaname_of_atttype,
1220 FROM dbms_stats.column_stats_effective co
1222 ON (co.starelid = a.attrelid AND co.staattnum = a.attnum)
1224 ON a.atttypid = t.oid
1225 JOIN pg_namespace n1
1226 ON t.typnamespace = n1.oid
1227 RIGHT JOIN dbms_stats.relation_stats_effective r
1228 ON co.starelid = r.relid
1229 JOIN pg_catalog.pg_class cl
1231 JOIN pg_catalog.pg_namespace n2
1232 ON cl.relnamespace = n2.oid
1233 -- WHERE n2.nspname = 'public'
1234 -- AND cl.relname = 'test'
1235 -- AND a.attname = 'id'
1236 WHERE n2.nspname = 's0'
1237 ORDER BY starelid, staattnum)
1242 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
1243 SELECT * FROM work_v;
1244 nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5
1245 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------------+------------+------------------+------------+------------
1246 s0 | sft0 | 0 | 0 | 0 | 0 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
1247 s0 | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2} | (null) | (null) | (null) | (null)
1248 s0 | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | t | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2,4,5,6} | (null) | (null) | (null) | (null)
1249 s0 | st0 | 1 | 2 | 1 | 1 | num | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {10,20} | (null) | (null) | (null) | (null)
1250 s0 | st0 | 1 | 2 | 1 | 1 | num | pg_catalog | int4 | -1 | t | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {10,20,40,50,60} | (null) | (null) | (null) | (null)
1251 s0 | st0_idx | 2 | 2 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
1252 s0 | st1 | 1 | 3 | 1 | 1 | id | pg_catalog | int4 | -1 | f | -1 | -1 | -1 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | {-1,22} | {-1,23} | {-1,24} | {-1,21} | {-1,25} | (null) | (null) | {4,5,6} | (null) | (null)
1253 s0 | st1 | 1 | 3 | 1 | 1 | num | pg_catalog | int4 | -1 | f | -2 | -2 | -2 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | {-2,22} | {-2,23} | {-2,24} | {-2,21} | {-2,25} | (null) | (null) | {40,50,60} | (null) | (null)
1254 s0 | st1_idx | 2 | 3 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
1255 s0 | st2 | 1 | 3 | 1 | 1 | id | pg_catalog | int4 | -1 | f | -1 | -1 | -1 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | {-1,22} | {-1,23} | {-1,24} | {-1,21} | {-1,25} | (null) | (null) | {1,2,3} | (null) | (null)
1256 s0 | st2 | 1 | 3 | 1 | 1 | txt | pg_catalog | text | -1 | f | -2 | -2 | -2 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | {-2,22} | {-2,23} | {-2,24} | {-2,21} | {-2,25} | (null) | (null) | {1,comment,test} | (null) | (null)
1257 s0 | st2_idx | 2 | 3 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
1258 s0 | st3 | 0 | 0 | 0 | 0 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
1261 \! rm export_effective_stats.sql.sample_test
1262 TRUNCATE dbms_stats.work;
1264 \! sed '/ORDER/i\\ WHERE cl.relname = '"\'st0\'" export_effective_stats.sql.sample > export_effective_stats.sql.sample_test
1265 \i export_effective_stats.sql.sample_test
1267 * If you want the statistics of per-relation or per-column, please modify
1268 * nspname, relname, and attname in 'WHERE' clause.
1270 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
1272 * If you want to chage the output file name, please modify the following name.
1275 COPY (SELECT n2.nspname,
1283 COALESCE(a.attname, ''),
1284 n1.nspname AS schemaname_of_atttype,
1311 FROM dbms_stats.column_stats_effective co
1313 ON (co.starelid = a.attrelid AND co.staattnum = a.attnum)
1315 ON a.atttypid = t.oid
1316 JOIN pg_namespace n1
1317 ON t.typnamespace = n1.oid
1318 RIGHT JOIN dbms_stats.relation_stats_effective r
1319 ON co.starelid = r.relid
1320 JOIN pg_catalog.pg_class cl
1322 JOIN pg_catalog.pg_namespace n2
1323 ON cl.relnamespace = n2.oid
1324 -- WHERE n2.nspname = 'public'
1325 -- AND cl.relname = 'test'
1326 -- AND a.attname = 'id'
1327 WHERE cl.relname = 'st0'
1328 ORDER BY starelid, staattnum)
1333 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
1334 SELECT * FROM work_v;
1335 nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5
1336 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------------+------------+---------------+------------+------------
1337 public | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | f | -1 | -1 | -1 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | {-1,22} | {-1,23} | {-1,24} | {-1,21} | {-1,25} | (null) | (null) | {1,2} | (null) | (null)
1338 public | st0 | 1 | 2 | 1 | 1 | name | pg_catalog | bpchar | 9 | f | -2 | -2 | -2 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | {-2,22} | {-2,23} | {-2,24} | {-2,21} | {-2,25} | (null) | (null) | {"test "} | (null) | (null)
1339 s0 | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2} | (null) | (null) | (null) | (null)
1340 s0 | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | t | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2,4,5,6} | (null) | (null) | (null) | (null)
1341 s0 | st0 | 1 | 2 | 1 | 1 | num | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {10,20} | (null) | (null) | (null) | (null)
1342 s0 | st0 | 1 | 2 | 1 | 1 | num | pg_catalog | int4 | -1 | t | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {10,20,40,50,60} | (null) | (null) | (null) | (null)
1343 s1 | st0 | 1 | 4 | 1 | 1 | id | pg_catalog | int4 | -1 | f | -1 | -1 | -1 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | {-1,22} | {-1,23} | {-1,24} | {-1,21} | {-1,25} | (null) | (null) | {1,2,3,4} | (null) | (null)
1344 s1 | st0 | 1 | 4 | 1 | 1 | num | pg_catalog | int4 | -1 | f | -2 | -2 | -2 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | {-2,22} | {-2,23} | {-2,24} | {-2,21} | {-2,25} | (null) | (null) | {15,25,35,45} | (null) | (null)
1347 \! rm export_effective_stats.sql.sample_test
1348 TRUNCATE dbms_stats.work;
1350 \! sed '/ORDER/i\\ WHERE cl.relname = '"\'pg_toast_1262\'" export_effective_stats.sql.sample > export_effective_stats.sql.sample_test
1351 \i export_effective_stats.sql.sample_test
1353 * If you want the statistics of per-relation or per-column, please modify
1354 * nspname, relname, and attname in 'WHERE' clause.
1356 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
1358 * If you want to chage the output file name, please modify the following name.
1361 COPY (SELECT n2.nspname,
1369 COALESCE(a.attname, ''),
1370 n1.nspname AS schemaname_of_atttype,
1397 FROM dbms_stats.column_stats_effective co
1399 ON (co.starelid = a.attrelid AND co.staattnum = a.attnum)
1401 ON a.atttypid = t.oid
1402 JOIN pg_namespace n1
1403 ON t.typnamespace = n1.oid
1404 RIGHT JOIN dbms_stats.relation_stats_effective r
1405 ON co.starelid = r.relid
1406 JOIN pg_catalog.pg_class cl
1408 JOIN pg_catalog.pg_namespace n2
1409 ON cl.relnamespace = n2.oid
1410 -- WHERE n2.nspname = 'public'
1411 -- AND cl.relname = 'test'
1412 -- AND a.attname = 'id'
1413 WHERE cl.relname = 'pg_toast_1262'
1414 ORDER BY starelid, staattnum)
1419 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
1420 SELECT * FROM work_v;
1421 nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5
1422 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------
1425 \! rm export_effective_stats.sql.sample_test
1426 TRUNCATE dbms_stats.work;
1428 \! sed '/ORDER/i\\ WHERE cl.relname = '"\'st0_idx\'" export_effective_stats.sql.sample > export_effective_stats.sql.sample_test
1429 \i export_effective_stats.sql.sample_test
1431 * If you want the statistics of per-relation or per-column, please modify
1432 * nspname, relname, and attname in 'WHERE' clause.
1434 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
1436 * If you want to chage the output file name, please modify the following name.
1439 COPY (SELECT n2.nspname,
1447 COALESCE(a.attname, ''),
1448 n1.nspname AS schemaname_of_atttype,
1475 FROM dbms_stats.column_stats_effective co
1477 ON (co.starelid = a.attrelid AND co.staattnum = a.attnum)
1479 ON a.atttypid = t.oid
1480 JOIN pg_namespace n1
1481 ON t.typnamespace = n1.oid
1482 RIGHT JOIN dbms_stats.relation_stats_effective r
1483 ON co.starelid = r.relid
1484 JOIN pg_catalog.pg_class cl
1486 JOIN pg_catalog.pg_namespace n2
1487 ON cl.relnamespace = n2.oid
1488 -- WHERE n2.nspname = 'public'
1489 -- AND cl.relname = 'test'
1490 -- AND a.attname = 'id'
1491 WHERE cl.relname = 'st0_idx'
1492 ORDER BY starelid, staattnum)
1497 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
1498 SELECT * FROM work_v;
1499 nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5
1500 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------
1501 public | st0_idx | 2 | 2 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
1502 s0 | st0_idx | 2 | 2 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
1505 \! rm export_effective_stats.sql.sample_test
1506 TRUNCATE dbms_stats.work;
1508 \! sed '/ORDER/i\\ WHERE cl.relname = '"\'ss0\'" export_effective_stats.sql.sample > export_effective_stats.sql.sample_test
1509 \i export_effective_stats.sql.sample_test
1511 * If you want the statistics of per-relation or per-column, please modify
1512 * nspname, relname, and attname in 'WHERE' clause.
1514 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
1516 * If you want to chage the output file name, please modify the following name.
1519 COPY (SELECT n2.nspname,
1527 COALESCE(a.attname, ''),
1528 n1.nspname AS schemaname_of_atttype,
1555 FROM dbms_stats.column_stats_effective co
1557 ON (co.starelid = a.attrelid AND co.staattnum = a.attnum)
1559 ON a.atttypid = t.oid
1560 JOIN pg_namespace n1
1561 ON t.typnamespace = n1.oid
1562 RIGHT JOIN dbms_stats.relation_stats_effective r
1563 ON co.starelid = r.relid
1564 JOIN pg_catalog.pg_class cl
1566 JOIN pg_catalog.pg_namespace n2
1567 ON cl.relnamespace = n2.oid
1568 -- WHERE n2.nspname = 'public'
1569 -- AND cl.relname = 'test'
1570 -- AND a.attname = 'id'
1571 WHERE cl.relname = 'ss0'
1572 ORDER BY starelid, staattnum)
1577 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
1578 SELECT * FROM work_v;
1579 nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5
1580 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------
1583 \! rm export_effective_stats.sql.sample_test
1584 TRUNCATE dbms_stats.work;
1586 \! sed '/ORDER/i\\ WHERE cl.relname = '"\'sc0\'" export_effective_stats.sql.sample > export_effective_stats.sql.sample_test
1587 \i export_effective_stats.sql.sample_test
1589 * If you want the statistics of per-relation or per-column, please modify
1590 * nspname, relname, and attname in 'WHERE' clause.
1592 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
1594 * If you want to chage the output file name, please modify the following name.
1597 COPY (SELECT n2.nspname,
1605 COALESCE(a.attname, ''),
1606 n1.nspname AS schemaname_of_atttype,
1633 FROM dbms_stats.column_stats_effective co
1635 ON (co.starelid = a.attrelid AND co.staattnum = a.attnum)
1637 ON a.atttypid = t.oid
1638 JOIN pg_namespace n1
1639 ON t.typnamespace = n1.oid
1640 RIGHT JOIN dbms_stats.relation_stats_effective r
1641 ON co.starelid = r.relid
1642 JOIN pg_catalog.pg_class cl
1644 JOIN pg_catalog.pg_namespace n2
1645 ON cl.relnamespace = n2.oid
1646 -- WHERE n2.nspname = 'public'
1647 -- AND cl.relname = 'test'
1648 -- AND a.attname = 'id'
1649 WHERE cl.relname = 'sc0'
1650 ORDER BY starelid, staattnum)
1655 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
1656 SELECT * FROM work_v;
1657 nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5
1658 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------
1661 \! rm export_effective_stats.sql.sample_test
1662 TRUNCATE dbms_stats.work;
1664 \! sed '/ORDER/i\\ WHERE cl.relname = '"\'sft0\'" export_effective_stats.sql.sample > export_effective_stats.sql.sample_test
1665 \i export_effective_stats.sql.sample_test
1667 * If you want the statistics of per-relation or per-column, please modify
1668 * nspname, relname, and attname in 'WHERE' clause.
1670 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
1672 * If you want to chage the output file name, please modify the following name.
1675 COPY (SELECT n2.nspname,
1683 COALESCE(a.attname, ''),
1684 n1.nspname AS schemaname_of_atttype,
1711 FROM dbms_stats.column_stats_effective co
1713 ON (co.starelid = a.attrelid AND co.staattnum = a.attnum)
1715 ON a.atttypid = t.oid
1716 JOIN pg_namespace n1
1717 ON t.typnamespace = n1.oid
1718 RIGHT JOIN dbms_stats.relation_stats_effective r
1719 ON co.starelid = r.relid
1720 JOIN pg_catalog.pg_class cl
1722 JOIN pg_catalog.pg_namespace n2
1723 ON cl.relnamespace = n2.oid
1724 -- WHERE n2.nspname = 'public'
1725 -- AND cl.relname = 'test'
1726 -- AND a.attname = 'id'
1727 WHERE cl.relname = 'sft0'
1728 ORDER BY starelid, staattnum)
1733 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
1734 SELECT * FROM work_v;
1735 nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5
1736 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------
1737 s0 | sft0 | 0 | 0 | 0 | 0 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
1740 \! rm export_effective_stats.sql.sample_test
1741 TRUNCATE dbms_stats.work;
1743 \! sed '/ORDER/i\\ WHERE n2.nspname = '"\'s0\'"' AND a.attname = '"\'id\'" export_effective_stats.sql.sample > export_effective_stats.sql.sample_test
1744 \i export_effective_stats.sql.sample_test
1746 * If you want the statistics of per-relation or per-column, please modify
1747 * nspname, relname, and attname in 'WHERE' clause.
1749 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
1751 * If you want to chage the output file name, please modify the following name.
1754 COPY (SELECT n2.nspname,
1762 COALESCE(a.attname, ''),
1763 n1.nspname AS schemaname_of_atttype,
1790 FROM dbms_stats.column_stats_effective co
1792 ON (co.starelid = a.attrelid AND co.staattnum = a.attnum)
1794 ON a.atttypid = t.oid
1795 JOIN pg_namespace n1
1796 ON t.typnamespace = n1.oid
1797 RIGHT JOIN dbms_stats.relation_stats_effective r
1798 ON co.starelid = r.relid
1799 JOIN pg_catalog.pg_class cl
1801 JOIN pg_catalog.pg_namespace n2
1802 ON cl.relnamespace = n2.oid
1803 -- WHERE n2.nspname = 'public'
1804 -- AND cl.relname = 'test'
1805 -- AND a.attname = 'id'
1806 WHERE n2.nspname = 's0' AND a.attname = 'id'
1807 ORDER BY starelid, staattnum)
1812 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
1813 SELECT * FROM work_v;
1814 nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5
1815 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------
1816 s0 | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | f | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2} | (null) | (null) | (null) | (null)
1817 s0 | st0 | 1 | 2 | 1 | 1 | id | pg_catalog | int4 | -1 | t | 0 | 4 | -1 | 2 | 3 | 0 | 0 | 0 | 97 | 97 | 0 | 0 | 0 | (null) | {1} | (null) | (null) | (null) | {1,2,4,5,6} | (null) | (null) | (null) | (null)
1818 s0 | st1 | 1 | 3 | 1 | 1 | id | pg_catalog | int4 | -1 | f | -1 | -1 | -1 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | {-1,22} | {-1,23} | {-1,24} | {-1,21} | {-1,25} | (null) | (null) | {4,5,6} | (null) | (null)
1819 s0 | st2 | 1 | 3 | 1 | 1 | id | pg_catalog | int4 | -1 | f | -1 | -1 | -1 | 2 | 3 | 4 | 1 | 5 | 22 | 23 | 24 | 21 | 25 | {-1,22} | {-1,23} | {-1,24} | {-1,21} | {-1,25} | (null) | (null) | {1,2,3} | (null) | (null)
1822 \! rm export_effective_stats.sql.sample_test
1823 TRUNCATE dbms_stats.work;
1825 \! sed '/ORDER/i\\ WHERE n2.nspname = '"\'s0\'"' AND a.attname IS NULL' export_effective_stats.sql.sample > export_effective_stats.sql.sample_test
1826 \i export_effective_stats.sql.sample_test
1828 * If you want the statistics of per-relation or per-column, please modify
1829 * nspname, relname, and attname in 'WHERE' clause.
1831 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
1833 * If you want to chage the output file name, please modify the following name.
1836 COPY (SELECT n2.nspname,
1844 COALESCE(a.attname, ''),
1845 n1.nspname AS schemaname_of_atttype,
1872 FROM dbms_stats.column_stats_effective co
1874 ON (co.starelid = a.attrelid AND co.staattnum = a.attnum)
1876 ON a.atttypid = t.oid
1877 JOIN pg_namespace n1
1878 ON t.typnamespace = n1.oid
1879 RIGHT JOIN dbms_stats.relation_stats_effective r
1880 ON co.starelid = r.relid
1881 JOIN pg_catalog.pg_class cl
1883 JOIN pg_catalog.pg_namespace n2
1884 ON cl.relnamespace = n2.oid
1885 -- WHERE n2.nspname = 'public'
1886 -- AND cl.relname = 'test'
1887 -- AND a.attname = 'id'
1888 WHERE n2.nspname = 's0' AND a.attname IS NULL
1889 ORDER BY starelid, staattnum)
1894 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
1895 SELECT * FROM work_v;
1896 nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5
1897 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------
1898 s0 | sft0 | 0 | 0 | 0 | 0 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
1899 s0 | st0_idx | 2 | 2 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
1900 s0 | st1_idx | 2 | 3 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
1901 s0 | st2_idx | 2 | 3 | 0 | 2 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
1902 s0 | st3 | 0 | 0 | 0 | 0 | | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null) | (null)
1905 \! rm export_effective_stats.sql.sample_test
1906 TRUNCATE dbms_stats.work;
1908 \! sed '/ORDER/i\\ WHERE n2.nspname = '"\'s0\'"' AND cl.relname IS NULL' export_effective_stats.sql.sample > export_effective_stats.sql.sample_test
1909 \i export_effective_stats.sql.sample_test
1911 * If you want the statistics of per-relation or per-column, please modify
1912 * nspname, relname, and attname in 'WHERE' clause.
1914 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
1916 * If you want to chage the output file name, please modify the following name.
1919 COPY (SELECT n2.nspname,
1927 COALESCE(a.attname, ''),
1928 n1.nspname AS schemaname_of_atttype,
1955 FROM dbms_stats.column_stats_effective co
1957 ON (co.starelid = a.attrelid AND co.staattnum = a.attnum)
1959 ON a.atttypid = t.oid
1960 JOIN pg_namespace n1
1961 ON t.typnamespace = n1.oid
1962 RIGHT JOIN dbms_stats.relation_stats_effective r
1963 ON co.starelid = r.relid
1964 JOIN pg_catalog.pg_class cl
1966 JOIN pg_catalog.pg_namespace n2
1967 ON cl.relnamespace = n2.oid
1968 -- WHERE n2.nspname = 'public'
1969 -- AND cl.relname = 'test'
1970 -- AND a.attname = 'id'
1971 WHERE n2.nspname = 's0' AND cl.relname IS NULL
1972 ORDER BY starelid, staattnum)
1977 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
1978 SELECT * FROM work_v;
1979 nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5
1980 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------
1983 \! rm export_effective_stats.sql.sample_test
1984 TRUNCATE dbms_stats.work;
1986 * Stab function dbms_stats.import
1988 ALTER FUNCTION dbms_stats.import(
1993 ) RENAME TO truth_import;
1994 CREATE FUNCTION dbms_stats.import(
2002 RAISE NOTICE 'arguments are "%", "%", "%", "%"', $1, $2, $3, $4;
2008 * No.17-1 dbms_stats.import_database_stats(src)
2011 SELECT dbms_stats.import_database_stats('@abs_srcdir@/export_stats.dmp');
2012 NOTICE: arguments are "<NULL>", "<NULL>", "<NULL>", "@abs_srcdir@/export_stats.dmp"
2013 import_database_stats
2014 -----------------------
2019 * No.17-2 dbms_stats.import_schema_stats(schemaname, src)
2022 SELECT dbms_stats.import_schema_stats('s0', '@abs_srcdir@/export_stats.dmp');
2023 NOTICE: arguments are "s0", "<NULL>", "<NULL>", "@abs_srcdir@/export_stats.dmp"
2025 ---------------------
2030 * No.17-3 dbms_stats.import_table_stats(relid, src)
2033 SELECT dbms_stats.import_table_stats('s0.st0', '@abs_srcdir@/export_stats.dmp');
2034 NOTICE: arguments are "<NULL>", "s0.st0", "<NULL>", "@abs_srcdir@/export_stats.dmp"
2036 --------------------
2041 * No.17-4 dbms_stats.import_table_stats(schemaname, tablename, src)
2044 SELECT dbms_stats.import_table_stats('s0', 'st0', '@abs_srcdir@/export_stats.dmp');
2045 NOTICE: arguments are "<NULL>", "s0.st0", "<NULL>", "@abs_srcdir@/export_stats.dmp"
2047 --------------------
2052 * No.17-5 dbms_stats.import_column_stats (relid, attname, src)
2055 SELECT dbms_stats.import_column_stats('s0.st0', 'id', '@abs_srcdir@/export_stats.dmp');
2056 NOTICE: arguments are "<NULL>", "s0.st0", "id", "@abs_srcdir@/export_stats.dmp"
2058 ---------------------
2063 * No.17-6 dbms_stats.import_column_stats (schemaname, tablename, attname, src)
2066 SELECT dbms_stats.import_column_stats('s0', 'st0', 'id','@abs_srcdir@/export_stats.dmp');
2067 NOTICE: arguments are "<NULL>", "s0.st0", "id", "@abs_srcdir@/export_stats.dmp"
2069 ---------------------
2074 * Delete stab function dbms_stats.import
2076 DROP FUNCTION dbms_stats.import(
2082 ALTER FUNCTION dbms_stats.truth_import(