Hi all.
When i collect report pt-query-digest to file - i see on long query trim for long parameters list (example)
id in (2,3,4,5,6,6,7,8,8,9,124,324,25,24,524,6,264./* … omited XXXX items … */
But when i run pt-query-digest with history table write - in history table i see full query with alll parameters.
How i can perform trim long parameters list for history tables mode ?
Hi @PavelVD,
I believe there is no option for that. The trim you see in the report comes from --shorten, and it is applied only when the text report is printed. The --history and --review tables always get the full sample query.
You can cut the IN list yourself with --filter. The filter runs after the fingerprint is made, so the query checksum stays the same and the shorter text goes to the report and to the history table. Put this in a file, for example shorten.txt ( one line, no trailing semicolon ):
$event->{arg} =~ s{(\bIN\s*\()([^)]+)(?=\))}{ my @v = split /,/, $2; @v > 20 ? $1 . join(",", @v[0..19]) . "/*... omitted " . (@v - 20) . " items ...*/" : $1 . $2 }gexsi; 1
and run
pt-query-digest --history h=...,D=percona,t=query_history --filter shorten.txt slow.log
It keeps the first 20 values of each IN list and replaces the rest with the same /… omitted N items …/ comment as the report.