Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rjuju/pg_show_rewritten_query
Print a query after rewrite stage
https://github.com/rjuju/pg_show_rewritten_query
Last synced: 24 days ago
JSON representation
Print a query after rewrite stage
- Host: GitHub
- URL: https://github.com/rjuju/pg_show_rewritten_query
- Owner: rjuju
- License: other
- Created: 2022-03-28T15:42:48.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-01-14T02:30:03.000Z (almost 2 years ago)
- Last Synced: 2024-04-24T05:25:31.420Z (7 months ago)
- Language: C
- Size: 11.7 KB
- Stars: 6
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
pg_show_rewritten_query
=======================Display a query as it will be executed, that is after the analyze and rewrite
steps.Installation
------------- Compatible with PostgreSQL 15 and above
- Needs PostgreSQL header files
- Decompress the tarball or clone the repository
- `sudo make install`
- create the extension "pg_show_rewritten_query" in the required database(s)Usage example
-------------```
CREATE EXTENSION pg_show_rewritten_query;SELECT * FROM pg_show_rewritten_query('select * from pg_stat_bgwriter');
pg_show_rewritten_query
--------------------------------------------------------------------------------------
SELECT checkpoints_timed, +
checkpoints_req, +
checkpoint_write_time, +
checkpoint_sync_time, +
buffers_checkpoint, +
buffers_clean, +
maxwritten_clean, +
buffers_backend, +
buffers_backend_fsync, +
buffers_alloc, +
stats_reset +
FROM ( SELECT pg_stat_get_bgwriter_timed_checkpoints() AS checkpoints_timed, +
pg_stat_get_bgwriter_requested_checkpoints() AS checkpoints_req, +
pg_stat_get_checkpoint_write_time() AS checkpoint_write_time, +
pg_stat_get_checkpoint_sync_time() AS checkpoint_sync_time, +
pg_stat_get_bgwriter_buf_written_checkpoints() AS buffers_checkpoint, +
pg_stat_get_bgwriter_buf_written_clean() AS buffers_clean, +
pg_stat_get_bgwriter_maxwritten_clean() AS maxwritten_clean, +
pg_stat_get_buf_written_backend() AS buffers_backend, +
pg_stat_get_buf_fsync_backend() AS buffers_backend_fsync, +
pg_stat_get_buf_alloc() AS buffers_alloc, +
pg_stat_get_bgwriter_stat_reset_time() AS stats_reset) pg_stat_bgwriter;+
(1 row)
```