Diego Fronza
775c087fb2
PG-222: Add benchmark support for measuring hook execution time.
...
Added a new view 'pg_stat_monitor_hook_stats' that provide execution
time statistics for all hooks installed by the module, following is a
description of the fields:
- hook: The hook function name.
- min_time: The fastest execution time recorded for the given hook.
- max_time: The slowest execution time recorded for the given hook.
- total_time: Total execution time taken by all calls to the hook.
- avg_time: Average execution time of a call to the hook.
- ncalls: Total number of calls to the hook.
- load_comparison: A percentual of time taken by an individual hook
compared to every other hook.
To enable benchmark, code must be compiled with -DBENCHMARK flag, this
will make the hook functions to be replaced by a function with the same
name plus a '_benchmark' suffix, e.g. hook_function_benchmark.
The hook_function_benchmark will call the original function and
calculate the amount of time it took to execute, than it will update
statistics for that hook.
2021-08-23 11:50:56 -04:00
Diego Fronza
33b22e4ef2
PG-203: Fix memory leak.
...
The query_txt variable is allocated at the beginning of the
pg_stat_monitor_internal() function and released at the end, but an
extra malloc call to allocate it was added within an internal loop in
the funcion, thus allocating memory for every loop iteration, without
releasing the memory in the loop.
The query_txt variable can be reused inside the loop body, so this
commit removes the redundant declaration of query_txt from inside the
loop, which also fixes the leak.
2021-08-06 15:52:29 -04:00
Diego Fronza
99f01d37e3
PG-200: Add application name to the bucket ID.
...
Add application name to the key used to identify queries in the hash
table, this allows different applications to have separate entries in
pg_stat_monitor view if they issued the same query.
2021-07-29 15:05:08 -04:00
Ibrar Ahmed
6c2e052396
PG-194: PostgreSQL 13.3 and 14 support.
2021-07-27 13:37:13 +00:00
Ibrar Ahmed
1dcf596194
Merge branch 'master' of https://github.com/percona/pg_stat_monitor
2021-07-27 12:58:22 +00:00
Ibrar Ahmed
815e543bfe
PG-194: PostgreSQL 13.3 and 14 support.
2021-07-27 12:57:29 +00:00
Diego Fronza
a3a4c99011
PG-197: Fix conflict with pg_stat_statements.
...
If pg_stat_monitor is loaded after pg_stat_statement, then it will end
up calling standard_planner function twice in the pgss_planner_hook()
function, this will trigger an assertion failure from PostgreSQL as this
function expects an untouched Query* object, and the first call to
standard_planner() done by pg_stat_statements modifies the object.
To address the problem, we avoid calling standard_planner function twice
in pg_stat_monitor, if a previous handler is installed for the hook
planner_hook, then we assume that this previous hook has already called
standard_planner function and don't do it again.
2021-07-26 10:16:29 -04:00
Ibrar Ahmed
f470ba591a
PG-194: PostgreSQL-14 support added.
2021-05-21 21:29:58 +05:00
Ibrar Ahmed
67b3d961ca
PG-193: Comment based tags to identify different parameters.
2021-05-19 22:15:37 +05:00
Ibrar Ahmed
89614e442b
PG-190: Does not show query, if query elapsed time is greater than bucket time.
2021-04-08 15:29:42 +05:00
Ibrar Ahmed
f42893472a
PG-189: Regression crash in case of PostgreSQL 11.
...
The size of string required to contain the queryid is smaller which
produce the crash.
2021-03-21 00:39:29 +05:00
Ibrar Ahmed
f8ed33a92a
PG-188: Added a new column to monitor the query state.
2021-03-21 00:04:39 +05:00
Ibrar Ahmed
96a7603aae
PG-187: Compilation Error for PostgreSQL 11 and PostgreSQL 12.
2021-03-17 20:42:58 +05:00
Ibrar Ahmed
e0fc683810
PG-186: Add support to monitor query execution plan.
2021-03-17 18:56:39 +05:00
Ibrar Ahmed
066162c3f6
PG-186: Add support to monitor query execution plan.
...
This requires refactoring of code to add this functionality. Along with
that this patch contains regression test cases.
2021-03-12 18:55:12 +00:00
Ibrar Ahmed
6aa1b2e7b6
PG-182: Added a new option for the query buffer overflow.
2021-02-17 13:08:39 +00:00
Ibrar Ahmed
0c9c25fbd9
PG-181: Segmentation fault in case of track_utility is ON.
2021-02-16 16:46:32 +00:00
Ibrar Ahmed
b115d748a8
PG-179. Skip lines for checking, and badge to README.
...
Patch By: Mikhail Samoylov
2021-02-16 12:46:53 +00:00
Ibrar Ahmed
963e509c65
PG-180: Relations column is not showing all the relations in case of PostgreSQL Version 11.
2021-02-16 12:35:33 +00:00
Ibrar Ahmed
a27a3798aa
PG-178: CI with github for PostgreSQL-11 and 12.
2021-02-15 17:23:44 +00:00
Ibrar Ahmed
e69465636d
PG-180: Relations column is not showing all the relations in case of PostgreSQL Version 11.
2021-02-15 14:26:45 +00:00
Ibrar Ahmed
d3278c0e4c
PG-178: Test cases fixes.
2021-02-15 12:29:03 +00:00
Ibrar Ahmed
ed6fe2d8dc
PG-147 Stored Procedure Support add parentid to track caller.
...
Patch By: Martin Sun
Reviewed By: Hamid Akhtar
2021-02-12 11:42:36 +00:00
Ibrar Ahmed
cba6bbfbd4
PG-177: Error in Histogram ranges.
2021-02-11 19:07:39 +00:00
Ibrar Ahmed
d60f725b4a
PG-176 : Extract fully qualified relations name.
2021-02-11 15:51:44 +00:00
Ibrar Ahmed
ce9d503cdb
PG-175: Only Superuser / Privileged user can view IP address.
2021-02-11 12:41:21 +00:00
Ibrar Ahmed
a6036b86ac
PG-174: Code cleanup.
2021-02-11 12:02:04 +00:00
Ibrar Ahmed
bd8c54476f
PG-150: Logging CMD Type like SELECT, UPDATE, INSERT, DELETE.
2021-02-10 14:55:40 +00:00
Ibrar Ahmed
fb819a5b23
PG-173: Added new WAL usage statistics.
2021-02-02 17:52:41 +00:00
Ibrar Ahmed
8410572ce3
PG-173: Added new WAL usage statistics.
2021-02-02 15:50:33 +00:00
Ibrar Ahmed
12ba1e39d1
PG-172: Exponential histogram for time buckets.
2021-02-02 15:30:28 +00:00
Ibrar Ahmed
8fea207cbf
PG-169: Use macros to avoid the potential buffer over run.
2021-01-22 17:34:05 +00:00
Hamid Akhtar
7f84b8d08e
PG-169: Fixing message buffer overrun and incorrect index access to fix the server crash.
...
Crash was occurring during server regression.
Reviewed By: Ibrar Ahmad.
2021-01-20 20:15:00 +05:00
Ibrar Ahmed
401e2b0505
PG-168: "calls" and histogram parameter does not match.
2021-01-19 13:05:54 +00:00
Ibrar Ahmed
10e0b4f0f6
PG-167: SQLERRCODE must be in readable format.
2021-01-19 12:35:52 +00:00
Ibrar Ahmed
412d9bc9b1
PG-166: Display actual system time instead of null.
2021-01-18 17:11:49 +00:00
Ibrar Ahmed
0e8f4c489c
PG-165: Recycle expired buckets.
2021-01-14 12:58:42 +00:00
Ibrar Ahmed
722435ec98
PG-161: Miscellaneous small issues.
2021-01-12 15:51:34 +00:00
Ibrar Ahmed
a297ac19ea
PG-161: Miscellaneous small issues.
2021-01-12 07:47:22 +00:00
Ibrar Ahmed
84de947da6
PG-160: Integration with PGXN.
2021-01-11 17:57:27 +00:00
Ibrar Ahmed
860de28e6f
PG-159: Bucket start time (bucket_start_time) should be aligned with bucket_time.
2021-01-11 17:20:27 +00:00
Ibrar Ahmed
44bab626f1
PG-158: Segmentation fault while using pgbench with clients > 1.
2021-01-08 18:12:04 +00:00
Ibrar Ahmed
9bee6b3690
Copyright Notice update.
2021-01-05 18:56:07 +00:00
Ibrar Ahmed
aeeaeaeb46
Revert "PG-156: Adding a placeholder replacement function for prepared statement"
...
This reverts commit 1e67e0b5bd
. The commit breaks some
functionality.
2021-01-05 18:51:00 +00:00
Martin Sun
1e67e0b5bd
PG-156: Adding a placeholder replacement function for prepared statement
...
When users set normalized_query to off and execute a prepared statement
user can see the actual value of parameters.
Reviewd By: Hamid Akhtar
2021-01-04 21:02:35 +08:00
Ibrar Ahmed
a2e1f89dea
Bumped version number to 0.7.0
2020-12-28 14:03:16 +00:00
Ibrar Ahmed
47ad105011
PG-150: Logging CMD Type like SELECT, UPDATE, INSERT, DELETE.
2020-12-06 16:38:48 +00:00
Ibrar Ahmed
bedc2ffc78
PG-154: Add backup option in case of no space left in the bucket.
2020-11-29 20:11:23 +00:00
Ibrar Ahmed
6ec5c2b4ed
PG-153: Log application name.
2020-11-24 21:03:32 +00:00
Ibrar Ahmed
057150c99b
Issue - ( #21 ): Show objects(tables) involved in the query.
...
PG-96
2020-11-24 20:10:49 +00:00
Ibrar Ahmed
971e57fd93
Issue - ( #62 ): Logging CMD Type like SELECT, UPDATE, INSERT and DELETE.
...
PG-150
2020-11-24 18:02:25 +00:00
Ibrar Ahmed
a668199dcf
Issue - ( #62 ): Logging CMD Type like SELECT, UPDATE, INSERT, DELETE, UNKNOWN.
...
PG-150
2020-11-12 15:46:17 +00:00
Ibrar Ahmed
5bea9f4581
Issue - ( #62 ): Logging CMD Type like SELECT, UPDATE, INSERT, DELETE, UNKNOWN.
...
PG-150
2020-11-12 13:14:27 +00:00
Ibrar Ahmed
3999e28c00
Issue - ( #61 ): Remove unnecessary code previously used for wait_events.
...
PG-146
2020-11-11 13:52:45 +00:00
Ibrar Ahmed
7b04755037
Issue - ( #60 ): Log error/warning/info and debug messages.
...
PG-136
2020-11-11 11:47:06 +00:00
Ibrar Ahmed
8918017134
Issue ( #59 ): Build failed using gcc-9 and 10.
...
The issue only occurs when compiled using -fno-common flag.
2020-11-02 11:21:47 +00:00
Ibrar Ahmed
bc47a0074b
Issue - ( #53 ): Fix a bug where the query response time histogram does show proper counters.
...
PG-143 : PostgreSQL-13 has a different issue so, special handling for PostgreSQL-13 done.
2020-10-12 22:53:37 +00:00
Ibrar Ahmed
ec1ff594b4
Issue - ( #54 ): Planning counters require renaming.
...
PG-144 : Changing planing counter name to sync with pg_stat_statment.
2020-10-12 22:39:44 +00:00
Ibrar Ahmed
f48a64cc0a
Issue - ( #53 ): Fix a bug where the query response time histogram does show proper counters.
...
PG-143 : Total sum of all the response histograms should be equal to total_calls.
2020-10-12 21:49:35 +00:00
Ibrar Ahmed
166ee0a25b
Issue - ( #51 ): Postgres process is taking too much CPU.
...
Jira: PG-141
There is lock conflict, so used LW_EXCLUSIVE instead of LW_SHARED. This
need to be investigated again and check the possibility to use a shared lock.
2020-10-12 19:41:48 +00:00
Ibrar Ahmed
b23df84af9
Issue - ( #52 ): Create a function to return the build version.
...
Jira: PG-142
2020-10-12 17:54:44 +00:00
Ibrar Ahmed
6170d1f77c
Issue - ( #51 ): postgres process is taking too much CPU.
...
Jira: PG-141
2020-10-12 17:45:37 +00:00
Ibrar Ahmed
0e67d5d68d
Issue - ( #50 ): Assertion Failure when pg_stat_statment and pg_stat_monitor used together.
...
Jira: PG-140
2020-10-12 17:44:57 +00:00
Ibrar Ahmed
dea16f1878
Issue ( #49 ): Duplicates in pg_stat_monitor.
...
Jira: PG-139
2020-10-10 22:46:53 +00:00
Ibrar Ahmed
d66a079b1b
Issue ( #47 ): Default values of setting are not set properly.
2020-09-30 12:49:05 +00:00
Ibrar Ahmed
935d063f13
Issue(30): Code refactoring.
2020-09-14 22:26:19 +00:00
Ibrar Ahmed
8e7256f500
Issue ( #42 ): pgbench still logs data in case of false value of pgsm_enable.
...
One place left to disable the logging in case of pgsm_enable is false.
PG-124.
2020-08-26 03:03:17 +05:00
Ibrar Ahmed
6700c9686e
Issue ( #42 ): Enable/Disable pg_stat_monitor should not require PostgreSQL restart.
...
PG-124
2020-08-17 15:01:32 +00:00
Ibrar Ahmed
a2c87d8398
Issue - ( #40 ): Cannot set pgsm_track value with psql client with alter system.
...
Removed the track option and added a new option pgsm_enable, which require a restart.
PG-122
2020-08-06 10:43:27 +00:00
Ibrar Ahmed
a5ae569e61
Issue - ( #35 ): Fix a compilation error on Centos.
2020-07-22 09:44:30 +00:00
Ibrar Ahmed
355436c4dc
Issue - ( #34 ): PostgreSQL Version 13 support added.
2020-06-23 17:24:21 +00:00
Ibrar Ahmed
5536041539
Issue - ( #33 ): Display all the custom configuration parameters used for pg_stat_monitor.
...
A new view named (pg_stat_monitor_settings) is added to see all the custom
configuration parameters and its default, min, max, and type.
2020-05-25 11:58:22 +00:00
Ibrar Ahmed
30a8e92aa8
Issue - ( #31 ): PostgreSQL Version 13 Support added.
2020-04-24 16:27:30 +00:00
Ibrar Ahmed
beca034067
Issue ( #30 ) - Code refactoring.
2020-04-15 09:49:02 +00:00
Ibrar Ahmed
fca8cd431a
Issue - ( #27 ): PG-106: Support for WaitEvents, similar to pg_stat_activity added.
2020-03-20 05:17:10 +00:00
Ibrar Ahmed
179e99d692
Major refactoring to support multiple new features.
...
Issue - (#16 ): PG-112: Change the column name "ip" to "client_ip" for readability purpose.
Issue - (#17 ): PG-111: Show all the queries from complete and incomplete buckets.
Issue - (#18 ): PG-108: Log the bucket start time.
Issue - (#19 ): PG-99: Response time histogram.
Issue - (#20 ): PG-97: Log CPU time for a query.
Issue - (#21 ): PG-96: Show objects(tables) involved in the query.
Issue - (#22 ): PG-93: Retain the bucket, and don't delete the bucket automatically.
Issue - (#23 ): PG-91: Log queries of all the databases.
Issue - (#24 ): PG-116: Restrict the query size.
Issue - (#3 ) : README file update.
2020-02-27 19:27:05 +00:00
Ibrar Ahmed
9f1cf3629d
Issue - ( #10 ): The hist_* is not working in CentOS.
...
Remove some old code, missed previously.
2019-12-03 10:46:32 +00:00
Ibrar Ahmed
344b12a3a6
Issue - ( #10 ): The hist_* is not working in CentOS.
2019-12-03 10:30:59 +00:00
Ibrar Ahmed
40e1df799e
Issue - ( #6 ): Build failed for PostgreSQL Version 12.
2019-12-02 19:29:20 +00:00
Ibrar Ahmed
8286fc44b0
Issue - ( #4 ): Missed to update the "total_calls" when executing the same query multiple times.
...
Forgot to update the "total_calls" column when a query executes
multipletimes, during refactoring.
2019-11-20 12:00:00 +00:00
Ibrar Ahmed
56d8375c38
Issue - ( #2 ): Extended pg_stat_statement to provide new features.
...
Support for database/user/client based aggregates added to access
these statistics with three new views added. Some new counters added
including min/max/mean's time histograms. We are saving the parameters
of the slow queries, which can be tested later. Did some refactoring
of the code, by renaming the whole extension from pg_stat_statement to
pg_stat_monitor.
2019-11-20 10:30:57 +00:00