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 1h6F3n-0000Nm-MU for pgsql-hackers@arkaria.postgresql.org; Tue, 19 Mar 2019 13:45:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h6F3l-00024O-JY for pgsql-hackers@arkaria.postgresql.org; Tue, 19 Mar 2019 13:45:41 +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 1h6F3l-000240-6R for pgsql-hackers@lists.postgresql.org; Tue, 19 Mar 2019 13:45:41 +0000 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h6F3S-0005h3-QQ for pgsql-hackers@lists.postgresql.org; Tue, 19 Mar 2019 13:45:40 +0000 Received: by mail-lf1-x133.google.com with SMTP id y62so6328190lfc.13 for ; Tue, 19 Mar 2019 06:45:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=jRjelcd+Vs1X71Iy8DGNsiecw5FevyjRV8+gc6Pr2GY=; b=T9Hc2ceVy9jBdoLDddONmGDqeCsk3vV2Yg4SFBT/vaM5g2e+F0aFmDxDT3tw2s1VcJ ucxH+L1595L8Q6GiLG63J6zGBQqEeubC+6XjNdYdg2+vYudnuvUwL+wZiOSiex8s+dV3 RyFmECrEQUpEBZWouKt7saU8Kh30ttt3IN1rbyIZGuiQxCH7cAb0i7d6tkHHIZhG7s+k V/V70oKnrLUgH4ytgUZYPQpxGT6nWbZop+2aaWNqdAgjVfDshz+wiUDCZ83vEWDUAoRS cKlsKxkaXIuApB6oY/gJv9a2bqTa9cXICNVZI+pbKYiHGz8SUE4Lv9qAWZxTQd5RvOLU JCDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=jRjelcd+Vs1X71Iy8DGNsiecw5FevyjRV8+gc6Pr2GY=; b=eqbMyb7vdOkuoQPcPgukr89RG01teWiDalLnW3F8cKw79RqFYUnTDx3cu7yMrn+isb t6GTJzXFHWh3gqNJ7c+0FsZoztWs5FvVpjekGhSemEERHs54zUWdWdiGz5rzQnlT5SSY Kv+VyXsjcTa++THdX6sXx9PlEDEbTlibwtNwm4rsKwohRlvKDRpjgMSm54JSrgNtB58m 1Gdnm5HcdcSIdLlhYdofQXvheGUh8WjYS2Gkzi3yL1pMKtuxVnMpGwwpFpaQeuYdaf7P A1DPhrWNPox/IEb0lEPGr48ydfZ3Fhe10LqcOUzpuoz5CmToAiTk7RTFMsFCt+4NZX4F 54Dg== X-Gm-Message-State: APjAAAX8yst9sUUCdBOnKVJrp3WsY7HVJwqxIjFpyWCkx2C4TKVdDjRG mTu2mNcgEgJbzcwYb3OaAFscHXes X-Google-Smtp-Source: APXvYqxK834nNqSJ0WTUZQKVSW/cjDCTFf9380xtto3NuuNJ1799WoN+5UCvOQbRaUIXX1yKkmBspg== X-Received: by 2002:ac2:44d0:: with SMTP id d16mr8492885lfm.164.1553003119251; Tue, 19 Mar 2019 06:45:19 -0700 (PDT) Received: from [192.168.27.213] ([93.174.131.141]) by smtp.gmail.com with ESMTPSA id v11sm2731648lfb.46.2019.03.19.06.45.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Mar 2019 06:45:17 -0700 (PDT) Subject: Re: Feature improvement: can we add queryId for pg_catalog.pg_stat_activity view? To: Robert Haas , Tom Lane Cc: Yun Li , PostgreSQL Hackers References: <21800.1552701008@sss.pgh.pa.us> From: Maksim Milyutin Message-ID: Date: Tue, 19 Mar 2019 16:45:17 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: 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 On 3/16/19 5:32 PM, Robert Haas wrote: > There's only one query ID field available, and > you can't use two extensions that care about query ID unless they > compute it the same way, and replicating all the code that computes > the query ID into each new extension that wants one sucks. I think we > should actually bite the bullet and move all of that code into core, > and then just let extensions say whether they care about it getting > set. +1. But I think that enough to integrate into core the query normalization routine and store generalized query strings (from which the queryId is produced) in shared memory (for example, hashtable that maps queryId to the text representation of generalized query). And activate normalization routine and filling the table of generalized queries by specified GUC. This allows to unbind extensions that require queryId from using pg_stat_statements and consider such computing of queryId as canonical. -- Regards, Maksim Milyutin