From: Tomas Vondra <tomas.vondra@2ndquadrant.com>
To: Julien Rouhaud <rjuju123@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Nikolay Samokhvalov <samokhvalov@gmail.com>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Bruce Momjian <bruce@momjian.us>
Cc: Alexey Kondratov <a.kondratov@postgrespro.ru>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: v.makarov@postgrespro.ru
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: [PATCH] Increase the maximum value track_activity_query_size
Date: Mon, 23 Dec 2019 13:10:54 +0100
Message-ID: <20191223121054.y4dlwcyfme5g6o2c@development> (raw)
In-Reply-To: <CAOBaU_Y3GgDgW-80w7ysCvTn_HJHUB7=7hmec1gXBJAixwf1Fw@mail.gmail.com>
References: <20191219154110.GL30116@momjian.us>
<556.1576771167@sss.pgh.pa.us>
<CA+Tgmobjp+cqjNW+397Ejbo=M8XNzykQPspfhbd39DVc8Wd7Wg@mail.gmail.com>
<7a4ecea0-949e-efa7-865f-0ef2ddce52c3@postgrespro.ru>
<20191220135704.GC29807@momjian.us>
<20191221024757.GF15758@paquier.xyz>
<CANNMO+LrCCMTJBgETVyWdRGmwkT8hO9utF1RtdpsO=w765z6PQ@mail.gmail.com>
<25274.1576963505@sss.pgh.pa.us>
<20191222000308.pbhw6l7izgx5yttw@development>
<CAOBaU_Y3GgDgW-80w7ysCvTn_HJHUB7=7hmec1gXBJAixwf1Fw@mail.gmail.com>
On Sun, Dec 22, 2019 at 09:06:41AM +0100, Julien Rouhaud wrote:
>On Sun, Dec 22, 2019 at 1:03 AM Tomas Vondra
><tomas.vondra@2ndquadrant.com> wrote:
>>
>> On Sat, Dec 21, 2019 at 04:25:05PM -0500, Tom Lane wrote:
>> >Nikolay Samokhvalov <samokhvalov@gmail.com> writes:
>> >> Here is what ORMs do:
>> >> select length('SELECT "column_name_1001", "column_name_1002",
>> >> "column_name_1003", "column_name_1004", "column_name_1005",
>> >> "column_name_1006", "column_name_1007", "column_name_1008",
>> >> "column_name_1009", "column_name_1010", "column_name_1011",
>> >> "column_name_1012", "column_name_1013", "column_name_1014",
>> >> "column_name_1015", "column_name_1016", "column_name_1017",
>> >> "column_name_1018", "column_name_1019", "column_name_1020",
>> >> "column_name_1021", "column_name_1022", "column_name_1023",
>> >> "column_name_1024", "column_name_1025", "column_name_1026",
>> >> "column_name_1027", "column_name_1028", "column_name_1029",
>> >> "column_name_1030", "column_name_1031", "column_name_1032",
>> >> "column_name_1033", "column_name_1034", "column_name_1035",
>> >> "column_name_1036", "column_name_1037", "column_name_1038",
>> >> "column_name_1039", "column_name_1040", "column_name_1041",
>> >> "column_name_1042", "column_name_1043", "column_name_1044",
>> >> "column_name_1045", "column_name_1046", "column_name_1047",
>> >> "column_name_1048", "column_name_1049", "column_name_1050" FROM
>> >> "some_table";');
>> >> length
>> >> --------
>> >> 1024
>> >> (1 row)
>> >
>> >> That's it – with default settings, you won't see WHERE clause or
>> >> anything else.
>> >
>> >If that's true, it doesn't offer much of a case for upping the limit
>> >on track_activity_query_size. The longest such a query could reasonably
>> >get is somewhere near NAMEDATALEN times MaxHeapAttributeNumber, which
>> >as it happens is exactly the existing limit on track_activity_query_size.
>> >
>> >> As a result, many queries exceed track_activity_query_size
>> >
>> >How? And if they are, why do you care? Such queries sure seem
>> >pretty content-free.
>> >
>>
>> I believe the example was just a very simplistic example. ORMs can of
>> course generate queries with joins, which can easily exceed the limit
>> you mentioned.
>>
>> >> What is the overhead here except the memory consumption?
>> >
>> >The time to copy those strings out of shared storage, any time
>> >you query pg_stat_activity.
>> >
>>
>> IMO that seems like a reasonable price to pay, if you want to see
>> complete queries and bump the track_activity_query_size value up.
>
>Couldn't be pg_stat_statements (or any similar extension) queryid
>exposure in pg_stat_activity [1] also an alternative? You wouldn't
>have the parameters but maybe the normalized query would be enough for
>most analysis. Now, maybe pg_stat_statements jumble overhead for such
>large statements would be even more problematic.
>
But that would effectively add dependency on pg_stat_statements, no? I
don't think we want that.
regards
--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: tomas.vondra@2ndquadrant.com, rjuju123@gmail.com, tgl@sss.pgh.pa.us, samokhvalov@gmail.com, michael@paquier.xyz, bruce@momjian.us, a.kondratov@postgrespro.ru, robertmhaas@gmail.com, v.makarov@postgrespro.ru
Subject: Re: [PATCH] Increase the maximum value track_activity_query_size
In-Reply-To: <20191223121054.y4dlwcyfme5g6o2c@development>
References: <20191219154110.GL30116@momjian.us> <556.1576771167@sss.pgh.pa.us> <CA+Tgmobjp+cqjNW+397Ejbo=M8XNzykQPspfhbd39DVc8Wd7Wg@mail.gmail.com> <7a4ecea0-949e-efa7-865f-0ef2ddce52c3@postgrespro.ru> <20191220135704.GC29807@momjian.us> <20191221024757.GF15758@paquier.xyz> <CANNMO+LrCCMTJBgETVyWdRGmwkT8hO9utF1RtdpsO=w765z6PQ@mail.gmail.com> <25274.1576963505@sss.pgh.pa.us> <20191222000308.pbhw6l7izgx5yttw@development> <CAOBaU_Y3GgDgW-80w7ysCvTn_HJHUB7=7hmec1gXBJAixwf1Fw@mail.gmail.com> <20191223121054.y4dlwcyfme5g6o2c@development>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox