Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gRlCr-0007By-Bw for pgsql-general@arkaria.postgresql.org; Tue, 27 Nov 2018 21:47:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gRlCq-000527-5q for pgsql-general@arkaria.postgresql.org; Tue, 27 Nov 2018 21:47:44 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gRlCp-000520-JD for pgsql-general@lists.postgresql.org; Tue, 27 Nov 2018 21:47:43 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gRlCm-0000WM-PB for pgsql-general@lists.postgresql.org; Tue, 27 Nov 2018 21:47:42 +0000 Received: by mail-pl1-x641.google.com with SMTP id k8so5613615pls.11 for ; Tue, 27 Nov 2018 13:47:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:cc:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=XSSIcCJab7GjawiNsjpXKDdDi3om+O0lSCGkoqw5+s8=; b=JknD1SnDDbreSzu3YVR6S+oMKtpfQuV4ODCawVexAQ4LB0oCRpbCs23esp1UXl0zs6 29gQbtPuTkCe1BmvRM+Hoo6KeKmYonnZZyyCa/UIW+kqLrdRaIA78skvfFd0BJ5H26Ft Qxe4Wrwmm39e/GrLJ/kabl4k6O079dg7RSKf+U7HBqph1yKWQ7Ivugur/pYDJASxR/7x hEuY8mI0bDKefEf+37oQG4lnoJ7E8qDS48pE0S6CRcc6iBylnCLWyqqApFFRrE+medTP fTScbQreDbGtSnjgGXpkIba78awVXjGebvgY+UU+9yOVDT/hxzOC4YvjgHLTylMa3IBE Xt0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:cc:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=XSSIcCJab7GjawiNsjpXKDdDi3om+O0lSCGkoqw5+s8=; b=TAtWE86eUCjRNDlXYhgbgiSf3Jazxi/pZ6royrOoedIbQCL5W9FeKifNrWWekX5YxP HAkgyN+z6JCM/A8jRS2uJPzynIJRLsQx5kqTQtjCp8LxspQx+tZL+PM9KzExlsK+Ynb4 8CelNjQS/4bbNO2lc+NndMgcSZ6ISCMMBa2LCnUwK+OAQq0Lh8CAirMrv68hBEYjvnHa 8234bBnCwB1lLjWXIt9D9dbn4joTsHL2YlAUkf6HGuKMgaaAfcbHYteAhC8OLi/rdQNu 6oUGwtbXAvqY5ybUQTK1EnBohpGaXT/YCj7gWjjH7G2msrvKULt5XSpDW1EzW1o//d+R U9Yw== X-Gm-Message-State: AA+aEWakDAdNV+pryt6vTElF29ReY0y5GynrnN/cPCh20+eT1jxRIDSa SFHMblk2tlryH9psI/fmRnbZ1HBF X-Google-Smtp-Source: AFSGD/VHKrtXyqPaH6OhFkyajQoSbRYafY3t/PZL4lAkwnJgOE9sWmDDd7forP0Fq89+mZuVlBeRTw== X-Received: by 2002:a17:902:b60a:: with SMTP id b10mr32348824pls.303.1543355259202; Tue, 27 Nov 2018 13:47:39 -0800 (PST) Received: from ?IPv6:2001:56a:703e:dc00:d978:e331:7a05:8d1f? (node-1w7jr9y4y5kkqrzqw3uy7ox7j.ipv6.telus.net. [2001:56a:703e:dc00:d978:e331:7a05:8d1f]) by smtp.gmail.com with ESMTPSA id p2sm5851476pfp.125.2018.11.27.13.47.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Nov 2018 13:47:38 -0800 (PST) Subject: Re: pg_stat_statements: can we extend the object names to the qualified names? To: legrand legrand References: <372d75cc-053b-1a07-948f-089408d3cd3a@gmail.com> <1543353009578-0.post@n3.nabble.com> From: Sergei Agalakov Cc: pgsql-general@lists.postgresql.org Message-ID: Date: Tue, 27 Nov 2018 14:47:37 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 In-Reply-To: <1543353009578-0.post@n3.nabble.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I don't agree. If we already had a column with the execution plan in the pg_stat_statements then it would be a workaround for the problem with the ambiguous names in the query text column. But we don't have such column, and I don't want to create a dependency on the unimplemented feature. I rather fancy an extra column query_qn with the query text where all the object names are substituted to the qualified names. Remember that this problem isn't about only table names. The query may have views, functions, operands etc. from the 'wrong' schema. Sergei Agalakov On 11/27/2018 2:10 PM, legrand legrand wrote: > A part of the answer would be to store > explain (verbose on) select count(*) from t1; > result in pg_stat_statements for the corresponding query... > > (Verbose On) gives the "qualified names": > > QUERY PLAN > --------------------------------------- > Aggregate (cost=19.38..19.39 rows=1 width=8) > Output: count(*) > -> Seq Scan on s1.t1 (cost=0.00..17.50 rows=750 width=0) > Output: a1, a2, a3, a4, a5, a6 > > > Extension pg_store_plans > https://github.com/ossc-db/pg_store_plans > can do it. > > Extesion auto_explain can help also. > > There are also some tryies to extend pg_stat_statements > with plans see > https://www.postgresql-archive.org/FEATURE-PATCH-pg-stat-statements-with-plans-td5940964.html > > Regards > PAscal > > > > > > > -- > Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html >