Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lgrPD-0004ij-K8 for pgsql-hackers@arkaria.postgresql.org; Wed, 12 May 2021 16:08:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lgrPC-0003dW-6x for pgsql-hackers@arkaria.postgresql.org; Wed, 12 May 2021 16:08:14 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lgrPB-0003dN-TK for pgsql-hackers@lists.postgresql.org; Wed, 12 May 2021 16:08:13 +0000 Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lgrP9-0006mk-0I for pgsql-hackers@postgresql.org; Wed, 12 May 2021 16:08:12 +0000 Received: by mail-ej1-x629.google.com with SMTP id gx5so35751269ejb.11 for ; Wed, 12 May 2021 09:08:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=cybertec; h=message-id:subject:from:to:cc:date:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=V1vp9P/K2B1KESZOC0YocN/3DS3TCcV9+VNLQJkOaNg=; b=jynYdxqa5sRfL0tL+NdBcEo7NoyIggSjgh9ceORCRRF07Nq5zdjbPLvJtXfwMxlhOl wwmLFxAm0cPnrAPgi2n9Ok515IKZQMxkK72DrjDG0pmi8f5wySTwc6+5IE5NoGlbDzV8 cWWLDFuUlPA1Uz9z+pFPmhtgQhtELg4t5Tplm7uoc24gpUkqr+2YlyQsClG60TttiYGR 5lkSiPtIWQTDMotdbz4YBgIVciFMOpbKC1wopQTDULenSfGz6GLpsbzv46TyEIRAIq7S k/pPY5PFZj3RINmj57ww/9Djvuf+vsddLnqZbeOXrv03mDUhUJNiRBiEiYGVuW6YTFEK 16fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=V1vp9P/K2B1KESZOC0YocN/3DS3TCcV9+VNLQJkOaNg=; b=CSLfMu9yhWEp2kbjoXMIjz8qmsWcddg81fgtQ3yKaDboyeSSBNTr5k2a2UWnG6fqb3 ZUm3fyKUbanoblIHpS20mE8ROWjghQkVXW5eH3zMj8bp5ntCd5wrXo7CcC797tkeSvJU 5+WEJqG2xg06KD1E0hUQNN+DR1TQHuPjXGHyInoO5JWIMbKArRxvMSyezSTkhC7IZyFt eQJG2WtE9oXAZ2QtZpPoFn9Ehj4teoEep7XCrmFEZeiTpR2PnTSNewjNE5bTvKvgBLXi MrxRKFucHOxdGWGKXLss+8awkBEZ+i4zBAh+rZmoKng5wOMiNEo6on0LDUH9GHAQf2EQ 6UOg== X-Gm-Message-State: AOAM53381CKGmXMFGVUR+srUU6iusAMDj3LIuif7d4wEKDZTFdXWJOh4 gNGi0+mJf7aJg7jd95LDcHZ8uQ== X-Google-Smtp-Source: ABdhPJxjlNtzPE3AGO5DJyIoID6+CalI+pHJK5jX9hj61qPJAkBWFM44/Fo+u7TeENZNuk0f7RMQ4w== X-Received: by 2002:a17:906:cede:: with SMTP id si30mr36429872ejb.99.1620835689137; Wed, 12 May 2021 09:08:09 -0700 (PDT) Received: from localhost.localdomain (mobiledyn-185-69-244-159.mrsn.at. [185.69.244.159]) by smtp.gmail.com with ESMTPSA id f24sm159166edt.44.2021.05.12.09.08.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 May 2021 09:08:08 -0700 (PDT) Message-ID: <1243864f97028b075b9e5b52931fce2ff0896f79.camel@cybertec.at> Subject: Re: RFC: Logging plan of the running query From: Laurenz Albe To: Bharath Rupireddy , torikoshia Cc: Pgsql Hackers Date: Wed, 12 May 2021 18:08:07 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, 2021-05-12 at 18:03 +0530, Bharath Rupireddy wrote: > On Wed, May 12, 2021 at 4:54 PM torikoshia wrote: > > During the discussion about memory contexts dumping[1], there > > was a comment that exposing not only memory contexts but also > > query plans and untruncated query string would be useful. > > > > postgres=# SELECT * FROM pg_log_current_plan(2155192); > > pg_log_current_plan > > --------------------- > > t > > (1 row) > > > > $ tail -f data/log/postgresql-2021-05-12.log > > > > 2021-05-12 17:37:19.481 JST [2155192] LOG: logging the plan of > > running query on PID 2155192 > > Query Text: SELECT a.filler FROM pgbench_accounts a JOIN > > pgbench_accounts b ON a.aid = b.aid; > > Merge Join (cost=0.85..83357.85 rows=1000000 width=85) > > Merge Cond: (a.aid = b.aid) > > -> Index Scan using pgbench_accounts_pkey on > > pgbench_accounts a (cost=0.42..42377.43 rows=1000000 width=89) > > -> Index Only Scan using pgbench_accounts_pkey on > > pgbench_accounts b (cost=0.42..25980.42 rows=1000000 width=4) I love the idea, but I didn't look at the patch. > Since it also shows up the full query text and the plan > in the server log as plain text, there are chances that the sensitive > information might be logged into the server log which is a risky thing > from security standpoint. I think that is irrelevant. A superuser can already set "log_statement = 'all'" to get this. There is no protection from superusers, and it is pointless to require that. Yours, Laurenz Albe