Commit Graph

199 Commits (3b9d125ba03aa1185ec52fa4600bb9843c0981f4)

Author SHA1 Message Date
Diego Fronza 0e06a4c701 PG-260: Fix display of queries in pg_stat_monitor view.
Don't display queries in PARSE or PLAN state, to keep it consistent
with previous behavior, this avoids showing intermediate scripts like
part of a procedure, such as:
$1
$1 := $3
2021-10-14 10:24:41 -03:00
Diego Fronza 8fdf0946fe PG-254: Add query location to hash table entries.
Whenever a new query is added to a query buffer, record the position
in which the query was inserted, we can then use this information to
locate the query in a faster way later on when required.

This allowed to simplify the logic in hash_entry_dealloc(), after
creating the list of pending queries, as the list is scanned we can copy
the query from the previous query buffer to the new one by using the
query position (query_pos), this avoids scanning the whole query buffer
when looking up for the queryid.

Also, when moving a query to a new buffer (copy_query), we update
the query_pos for the hash table entry, so it points to the right place
in the new query buffer.

read_query() function was updated to allow query position to be passed
as argument, if pos != 0 use it to locate the query directly, otherwise
fallback to the previous mode of scanning the whole buffer.

SaveQueryText() was updated to pass a reference to the query position as
argument, this value is updated after the function finishes with the
position that the query was stored into the buffer.
2021-10-07 10:06:20 -03:00
Diego Fronza fcb70ffed1 PG-254: Removal of pgss_query_hash hash table.
There was no necessity for using a separate hash table to keep track
of queries as all the necessary information is already available in
the pgss_hash table.

The code that moves pending queries' text in hash_query_entry_dealloc
was merged into hash_entry_dealloc.

Couple functions were not necessary anymore, thus were removed:
- hash_create_query_entry
- pgss_store_query_info
- pgss_get_entry (this logic was added directly into pgss_store).

We simplified the logic in pgss_store, it basically works as follows:
1. Create a key (bucketid, queryid, etc...) for the query event.
2. Lookup the key in pgss_hash, if no entry exists for the key, create a
   new one, save the query text into the current query buffer.
3. If jstate == NULL, then update stats counters for the entry.
2021-10-06 14:57:15 -03:00
Diego Fronza fc9e630497 PG-254: Postpone variable initialization.
There were many variables being initialized in pgss_store() before
checking if the module was actually active, this would waste cpu
processor if the module is disabled.

To fix that, declare variables and initialize them only after check
that pg_stat_monitor is active.
2021-10-06 14:44:57 -03:00
Ibrar Ahmed a93ba37ac3 PG-246, PG-211, PG-147: Fix performance issue while querying the pg_stat_monitor.
This performance fix resolves two more issues (PG-211, PG-147).
2021-10-05 20:33:34 +00:00
Diego Fronza a959acb3d5 PG-244: Move pending queries' text to new bucket after bucket expiration.
Added code to move all pending queries text from an expired bucket's query
buffer to the next, active query buffer.

The previous implementation was not very efficient, it worked like this,
as soon as a query is processed and a bucket expires:

1. Allocate memory to save the contents of the next query buffer.
2. Clear the next query buffer.
3. Iterate over pgss_query_hash, then, for each entry:
   - If the entry's bucket id is equal to the next bucket then:
     -- If the query for this entry has finished or ended in error, then
        remove it from the hash table.
     -- Else, if the query is not yet finished, copy the query from the
        backup query buffer to the new query buffer.
	Now, this copy was really expensive, because it was implemented
	using read_query() / SaveQueryText(), and read_query() scans the
	whole query buffer looking for some query ID, since we do this
	extra lookup loop for each pending query we end up with a O(n^2)
	algorithm.
4. Release the backup query buffer.

Since now we always move pending queries from an expired bucket to the
next one, there is no need to scan the next query buffer for pending
queries (the pending queries are always in the current bucket, and when
it expires we move them to the next one).

Taking that into consideration, the new implementation works as follows,
whenever a bucket expires:

1. Clear the next query buffer (all entries).
2. Define an array to store pending query ids from the expired bucket,
   we use this array later on in the algorithm.
3. Iterate over pgss_query_hash, then, for each entry:
   - If the entry's bucket id is equal to the next bucket then:
     -- If the query for this entry has finished or ended in error, then
        remove it from the hash table. This is equal to the previous
	implementation.
   - Else, if the entry's bucket id is equal to the just expired bucket
     id (old bucket id) and the query state is pending (not yet finished),
     then add this query ID to the array of pending query IDs.

     Note: We define the array to hold up to 128 pending entries, if there
     are more entries than this we try to allocate memory in the heap to
     store them, then, if the allocation fails we manually copy every
     pending query past the 128th to the next query buffer, using the
     previous algorithm (read_query() / SaveQueryText), this should be a
     very rare situation.
4. Finally, if there are pending queries, copy them from the previous
   query buffer to the next one using copy_queries.

Now, copy_queries() is better than looping through each query entry and
calling read_query() / SaveQueryText() to copy each of them to the new
buffer, as explained, read_query() scans the whole query buffer for
every call.

copy_queries(), instead, scans the query buffer only once, and for every
element it checks if the current query id is in the list of queries to
be copied, this is an array of uint64 that is small enough to fit in L1
cache.

Another important fix in this commit is the addition of the line 1548 in
pg_stat_monitor.c / pgss_store():
query_entry->state = kind;

Before the addition of this line, all entries in the pgss_query_hash
hash table were not having their status updated when the query entered
execution / finished or ended in error, effectively leaving all entries
as pending, thus whenever a bucket expired all entries were being copied
from the expired bucket to the next one.
2021-10-01 15:27:45 -03:00
Diego Fronza 89743e9243 PG-244: Fix race condition in get_next_wbucket().
The if condition bellow in geta_next_wbucket() was subject to a race
condition:
if ((current_usec - pgss->prev_bucket_usec) > (PGSM_BUCKET_TIME * 1000 *
1000))

Two or more threads/processes could easily evaluate this condition to
true, thus executing more than once the block that would calculate a
new bucket id, clear/move old entries in the pgss_query_hash and
pgss_hash hash tables.

To avoid this problem, we define prev_bucket_usec and current_wbucket
variables as atomic and execute a loop to check if another thread has
updated prev_bucket_usec before the current one.
2021-09-30 17:13:27 -03:00
Diego Fronza 273f23b161 PG-230: Fix duplicated query entries.
A problem during bucket management was allowing some queries to be
duplicated, old entries would sit around without having their statistics
updated.

The problem would arise during the following chain of events:
1. A query goes through pgss_post_parse_analyze, in this stage (PGSS_PARSE)
   we only save the query into the query buffer and create an entry in the
   query hash table.
2. The query then goes through pgss_ExecutorStart (PGSS_EXEC), in this stage
   we create an entry for query statistic counters with default values,
   all time stats equal zero, etc.
3. The query then goes through pgss_ExecutorEnd (PGSS_FINISH), in this stage
   we update the query statistis, no. calls, total time taken, min_time, etc.

The problem is that between steps 2 and 3, the current bucket ID timer may
have been expired.

For example, during steps 1 and 2 the query may have been stored in
bucket ID 1, but when the query is finished (pgss_ExecutorEnd) the
current bucket ID may have been updated to 2.

This is leaving an entry for the query in bucket ID 1 with state ACTIVE,
with time statistics not updated yet.

This is also creating an entry for the query in the bucket ID 2, with all
statistics (time and others) being updated for this entry.

To solve this problem, during transition to a new bucket id, we scan all
pending queries in the previous bucket id and move them to the new
bucket id.

This way finished queries will always be associated with the bucket id
that was active at the time they've finished.
2021-09-28 16:12:34 -03:00
Andrew Pogrebnoy b4d4dae29f PG-232: revome unsed declrations 2021-09-22 17:10:52 +03:00
Hamid Akhtar d633126a2d Bumping version for upcoming 0.9.2-beta1 release 2021-09-06 15:21:55 +05:00
Diego Fronza eafb2e89a8 PG-225: Fix deadlock in pgss_store.
The deadlock scenario is describe below:
1. pgss_store is called, it acquires the lock pgss->lock.
2. An error ocurr, mostly out of memory when accessing internal hash
   tables used to store internal data, on functions
   pgss_store_query_info and pgss_get_entry.
3. Call elog() to report out of memory error.
4. Our pgsm_emit_log_hook is called, it calls pgss_store_error, which in
   turn calls pgss_store.
5. Try to acquire already acquired lock pgss->lock, deadlock happens.

To fix the problem, there are two modifications worth mentioning done by
this commit:
1. We are now passing HASH_ENTER_NULL flag to hash_search, instead of
   HASH_ENTER, as read in postgresql sources, this prevents this
   function from reporting error when out of memory, but instead it will
   only return NULL if we pass HASH_ENTER_NULL, so we can handle the
   error ourselves.
2. In pgss_store, if an error happens after the pgss->lock is acquired,
   we only set a flag, then, after releasing the lock, we check if the
   flag is set and report the error accordingly.
2021-09-03 14:43:32 -04:00
Diego Fronza b8198278cd PG-204: Fix save previous emit_log_hook.
pg_stat_monitor was not saving the pointer to the previous hook for
emit_log_hook, this commit fix the issue.
2021-09-01 11:19:48 -04:00
Diego Fronza b5aa300e82 pg-224: Fix memory leak on extract_query_comments.
There were two objects leaking memory in this function, the comments
variable of type char * allocated using palloc0, and the regular
expression object preg.

If the regcomp function failed, the function was returning without
releasing the comments variable allocated previously.

If the regexec function failed, the function was returning without
releasing the preg object and the comments variable.

This commit does two changes, first it turns the comments in
extract_query_comments an argument to the function, in pgss_store we
declare the comments variable in the stack, so it will clean up after
itself.

The second change was to move the regular expression object to global
scope, this way we compile the object only once, during module
initialization.

With these two changes we fix the memory leak and avoid
allocating/releasing memory for every call to this function.
2021-08-31 18:29:22 -04:00
Ibrar Ahmed 3d3ece2f99 PG-221: Use alternate of GetUserID function in error hook. 2021-08-31 14:55:53 +00:00
Ibrar Ahmed aee45ebe52 PG-221: Use alternat of GetUserID function in error hook. 2021-08-31 12:10:11 +00:00
Diego Fronza 549347025d PG-223: Use memcpy and strlcpy to copy relations to counters.
We redefine macro _snprintf to use memcpy, which performs better, we
also update call sites using this macro to add the null terminator
'\0' to the source string length, this way memcpy also correctly
copies the null terminator to the destination string.

We update _snprintf2 macro to use strlcpy, the reason we don't use
memcpy here is because in the place where this macro is called,
pgss_update_entry, only the maximum string length of REL_LEN=1000 is
specified as an upper bound to copy the relations string vector to the
destination counters, but since this data is string, we don't need to
copy 1k bytes for every entry, by using strlcpy the copy ends as soon as
the null terminator '\0' is found in the source string.
2021-08-27 17:07:34 -04:00
Diego Fronza a847ed95de PG-223: Remove relations and num_relations from pgssSharedState.
These variables can't be in shared state, as the following problem was
taking place:
1. Process1 call pgss_ExecutorCheckPerms(), acquire lock, update
   relations and num_relations, release lock.
2. Process 2 call pgss_ExecutorCheckPerms(), acquire lock, update
   num_relations = 0;
3. Process 1 read num_relations = 0 in pgss_update_entry, this value is
   wrong as it was updated by Process 2.

Even if we acquire the lock in pgss_update_entry to read num_relations
and relations variable, Process 1 may end up acquiring the lock after
Process 2 has ovewritten the variable values, leading to Process 1
reading of wrong data.

By defining relations and num_relations to be static and global in
pg_stat_monitor.c we take advantage that each individual PostgreSQL
backend will have its own copy of this data, which allows us to remove
the locking in pgss_ExecutorCheckPerms to update these variables,
improving pg_stat_monitor overall performance.
2021-08-27 15:53:11 -04:00
Ibrar Ahmed f3962509fb
Merge pull request #94 from darkfronza/PG-203_possible_memory_leak
PG-203: Fix memory leak.
2021-08-23 21:30:54 +05:00
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