May 2017
Beginner
416 pages
10h 37m
English
Many ORMs such as Hibernate generate insanely long SQL statements. The trouble is this: pg_stat_activity will store only the first 1024 bytes of the query in the system view. The rest is truncated. In case of a long query generated by an ORM such as Hibernate, the query is cut off before the interesting parts (the FROM clause and so on) actually start.
The solution to the problem is to set a config parameter in the postgresql.conf file:
test=# SHOW track_activity_query_size; track_activity_query_size --------------------------- 1024 (1 row)
Increase this parameter to a reasonably high value (maybe 32,768) and restart PostgreSQL. You will then be able to see a lot longer queries and be able to detect issues ...
Read now
Unlock full access