|
19 | 19 | This means that a server restart is needed to add or remove the module. |
20 | 20 | </para> |
21 | 21 |
|
| 22 | + <para> |
| 23 | + When <filename>pg_stat_statements</filename> is loaded, it tracks |
| 24 | + statistics across all databases of the server. To access and manipulate |
| 25 | + these statistics, the module provides a view, <structname>pg_stat_statements</>, |
| 26 | + and the utility functions <function>pg_stat_statements_reset</> and |
| 27 | + <function>pg_stat_statements</>. These are not available globally but |
| 28 | + can be enabled for a specific database with |
| 29 | + <command>CREATE EXTENSION pg_stat_statements</>. |
| 30 | + </para> |
| 31 | + |
22 | 32 | <sect2> |
23 | 33 | <title>The <structname>pg_stat_statements</structname> View</title> |
24 | 34 |
|
25 | 35 | <para> |
26 | 36 | The statistics gathered by the module are made available via a |
27 | | -systemview named <structname>pg_stat_statements</>. This view |
| 37 | + view named <structname>pg_stat_statements</>. This view |
28 | 38 | contains one row for each distinct database ID, user ID and query |
29 | 39 | ID (up to the maximum number of distinct statements that the module |
30 | 40 | can track). The columns of the view are shown in |
|
215 | 225 | </tgroup> |
216 | 226 | </table> |
217 | 227 |
|
218 | | - <para> |
219 | | - This view, and the functions <function>pg_stat_statements_reset</> |
220 | | - and <function>pg_stat_statements</>, are available only in |
221 | | - databases they have been specifically installed into by installing |
222 | | - the <literal>pg_stat_statements</> extension. |
223 | | - However, statistics are tracked across all databases of the server |
224 | | - whenever the <filename>pg_stat_statements</filename> module is loaded |
225 | | - into the server, regardless of presence of the view. |
226 | | - </para> |
227 | | - |
228 | 228 | <para> |
229 | 229 | For security reasons, non-superusers are not allowed to see the SQL |
230 | | - text or <structfield>queryid</structfield> of queries executed by other users. They can see |
231 | | - the statistics, however, if the view has been installed in their |
| 230 | + text or <structfield>queryid</structfield> of queries executed by other users. |
| 231 | +They can seethe statistics, however, if the view has been installed in their |
232 | 232 | database. |
233 | 233 | </para> |
234 | 234 |
|
|