From 5f70a04c56b69fff0f356abae3091eaa54038a5b Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Wed, 28 Apr 2010 16:48:21 +0000 Subject: [PATCH] Make pg_stats example query result a bit less wide, and add comment about pg_stats.inherited --- doc/src/sgml/perform.sgml | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/doc/src/sgml/perform.sgml b/doc/src/sgml/perform.sgml index bd93cb0dd2..a2f7e0629f 100644 --- a/doc/src/sgml/perform.sgml +++ b/doc/src/sgml/perform.sgml @@ -1,4 +1,4 @@ - + Performance Tips @@ -554,16 +554,31 @@ WHERE relname LIKE 'tenk1%'; For example, we might do: -SELECT attname, n_distinct, most_common_vals +SELECT attname, inherited, n_distinct, + array_to_string(most_common_vals, E'\n') as most_common_vals FROM pg_stats WHERE tablename = 'road'; - attname | n_distinct | most_common_vals ----------+------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - name | -0.467008 | {"I- 580 Ramp","I- 880 Ramp","Sp Railroad ","I- 580 ","I- 680 Ramp","I- 80 Ramp","14th St ","5th St ","Mission Blvd","I- 880 "} - thepath | 20 | {"[(-122.089,37.71),(-122.0886,37.711)]"} + attname | inherited | n_distinct | most_common_vals +---------+-----------+------------+------------------------------------ + name | f | -0.363388 | I- 580 Ramp+ + | | | I- 880 Ramp+ + | | | Sp Railroad + + | | | I- 580 + + | | | I- 680 Ramp + name | t | -0.284859 | I- 880 Ramp+ + | | | I- 580 Ramp+ + | | | I- 680 Ramp+ + | | | I- 580 + + | | | State Hwy 13 Ramp (2 rows) + + Note that two rows are displayed for the same column, one corresponding + to the complete inheritance hierarchy starting at the + road table (inherited=t), + and another one including only the road table itself + (inherited=f).