Hi Team,
We can only view half of the query, as the query has been truncated in the QAN.
Could you please tell me how I may retrieve the whole query in the QAN?
Hi Team,
We can only view half of the query, as the query has been truncated in the QAN.
Could you please tell me how I may retrieve the whole query in the QAN?
Hi,
As per the postgres documentation âŠ
track_activity_query_size
(integer
)Specifies the amount of memory reserved to store the text of the currently executing command for each active session, for the
pg_stat_activity
.query
field. If this value is specified without units, it is taken as bytes. The default value is 1024 bytes. This parameter can only be set at server start.
Hope this helps.
Thanks @Robert_Bernier for the quick response.
Is there any performance impact if we increase the âtrack_activity_query_sizeâ parameter in the PostgreSQL database, however we did not specify anything for Mariadb, therefore I am simply curious on the DB performance.
No performance impact.
regards
Thanks to @Robert_Bernier for all the information.
I have checked in the DB, and I can see only 2KB. But the default value is 1024 bytes.
2kB
(1 row)
postgres=#
postgres=#
I have already set to 2GB. but still its showing 2 KB.
[postgres@rntpgd201 12]$ cat /db/pgdata/12/postgresql.conf |grep -i âtrack_activity_query_sizeâ
#track_activity_query_size = 1024 # (change requires restart)
track_activity_query_size = 2048 # Increase tracked query string size
[postgres@rntpgd201 12]$
Thereâs a hardcoded limit of 100KB so you canât go to 2GB. As per your message, you also have to restart the server for the new parameter to take effect.
â server restart is required
alter system set track_activity_query_size=â100kBâ;
Hope this helps.
Unfortunately, the postgresql.log file contains the entire query, whereas QAN just contains the trimmed query (half of the query).
They PMM maintainers have asked me âWhat is the string length of your queryâ?
Following up âŠ
You need to remove and add the server again in order to perform the following
pmm-admin add postgresql server-1 --max-query-length=3072
and this bug report âŠ
Thanks @Robert_Bernier
Iâll try the above option and let you know what happens.
@Naresh9999, what do you use inside PostgreSQL pg_stat_statements or pg_stat_monitor ?
We are utilizing both the monitors.
pgaudit, pgauditlogtofile, pg_stat_statements, pg_stat_monitor
(1 row)
2.0.1
(1 row)
Still, I can see only the trimmed query.
Any thoughts on this issue? Am I missing something here? This is how I have added the PostgreSQL servers in the PMM.
pmm-admin add postgresql --server-insecure-tls --username=âpmm_usrâ --password=âxxxxxxxxxxxxâ --host=â10.112.xx.xxâ --port=5432 --service-name=C-QA-xxxx --query-source=âpgstatmonitorâ --max-query-length=3072 --environment=C-QA
@Naresh9999 check the data you have in `pg_stat_monitor` view reference - pg_stat_monitor Documentation
Are there full queries collected?
I can see the below output.
sds=# \d pg_stat_monitor;
View âpublic.pg_stat_monitorâ
Column | Type | Collation | Nullable | Default
---------------------±-------------------------±----------±---------±--------
bucket | bigint | | |
bucket_start_time | timestamp with time zone | | |
userid | oid | | |
username | text | | |
dbid | oid | | |
datname | text | | |
client_ip | inet | | |
pgsm_query_id | bigint | | |
queryid | bigint | | |
top_queryid | bigint | | |
query | text | | |
comments | text | | |
planid | bigint | | |
query_plan | text | | |
top_query | text | | |
application_name | text | | |
relations | text | | |
cmd_type | integer | | |
cmd_type_text | text | | |
elevel | integer | | |
sqlcode | text | | |
message | text | | |
calls | bigint | | |
total_time | double precision | | |
min_time | double precision | | |
max_time | double precision | | |
mean_time | double precision | | |
stddev_time | double precision | | |
rows | bigint | | |
shared_blks_hit | bigint | | |
shared_blks_read | bigint | | |
shared_blks_dirtied | bigint | | |
shared_blks_written | bigint | | |
local_blks_hit | bigint | | |
local_blks_read | bigint | | |
local_blks_dirtied | bigint | | |
local_blks_written | bigint | | |
temp_blks_read | bigint | | |
temp_blks_written | bigint | | |
blk_read_time | double precision | | |
blk_write_time | double precision | | |
resp_calls | text | | |
cpu_user_time | double precision | | |
cpu_sys_time | double precision | | |
bucket_done | boolean | | |
sds=#
In the Postgresql.log file, I can see the full query.
@Naresh9999, can you select * from this table? do you have data inside it ?
Unanswered | Unsolved | Solved
MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright © 2006 - 2024 Percona LLC. All rights reserved.