equal
deleted
inserted
replaced
59 ============== |
59 ============== |
60 :: |
60 :: |
61 |
61 |
62 SELECT name, setting FROM pg_settings; |
62 SELECT name, setting FROM pg_settings; |
63 |
63 |
|
64 Check extensions |
|
65 ================ |
|
66 :: |
|
67 |
|
68 SELECT * FROM pg_available_extensions; |
|
69 |
64 List databases, schemas and tables |
70 List databases, schemas and tables |
65 ================================== |
71 ================================== |
66 |
72 |
67 Default database is ``postgres``. |
73 Default database is ``postgres``. |
68 |
74 |
79 |
85 |
80 => \connect NAME |
86 => \connect NAME |
81 |
87 |
82 Schemas:: |
88 Schemas:: |
83 |
89 |
84 => select schema_name from information_schema.schemata; |
90 \dn * |
85 => select nspname from pg_catalog.pg_namespace; |
91 select schema_name from information_schema.schemata; |
86 => \dn * |
92 select nspname from pg_catalog.pg_namespace; |
87 |
93 |
88 To list all tables in the current database:: |
94 To list all tables in the current database:: |
89 |
95 |
90 => SELECT table_schema,table_name FROM information_schema.tables ORDER BY table_schema,table_name; |
96 \dt |
91 => \dt |
97 SELECT table_schema, table_name FROM information_schema.tables ORDER BY table_schema, table_name; |
92 |
98 |
93 or in all schemas:: |
99 or in all schemas:: |
94 |
100 |
95 => \dt *.* |
101 => \dt *.* |
96 |
102 |
108 \dn |
114 \dn |
109 |
115 |
110 List indexes:: |
116 List indexes:: |
111 |
117 |
112 \di |
118 \di |
|
119 select * from pg_indexes; |
|
120 select * from pg_indexes where schemaname = '...'; |
|
121 select * from pg_indexes where schemaname = '...' and tablename = '...'; |
|
122 select * from pg_indexes where schemaname = '...' and indexname = '...'; |
113 |
123 |
114 List functions:: |
124 List functions:: |
115 |
125 |
116 \df |
126 \df |
117 |
127 |
173 transaction id (monotonous incremented number): ``xmin`` - first transaction that can see row, |
183 transaction id (monotonous incremented number): ``xmin`` - first transaction that can see row, |
174 ``xmax`` - last transaction that can see row::: |
184 ``xmax`` - last transaction that can see row::: |
175 |
185 |
176 SELECT xmin, xmax, * FROM foo WHERE id < 5 ORDER BY id; |
186 SELECT xmin, xmax, * FROM foo WHERE id < 5 ORDER BY id; |
177 |
187 |
|
188 Vacuum |
|
189 ====== |
|
190 |
|
191 Stats on vacuum oprtations per table:: |
|
192 |
|
193 select * from pg_stat_user_tables; |
|
194 |
178 Using psql client |
195 Using psql client |
179 ================= |
196 ================= |
180 |
197 |
181 Using password file ``~/.pgpass``:: |
198 Using password file ``~/.pgpass``:: |
182 |
199 |