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 1ioRvF-0001cK-Cd for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Jan 2020 12:55:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ioRvE-0003DQ-4V for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Jan 2020 12:55:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ioRs7-0007WW-Rp for pgsql-hackers@lists.postgresql.org; Mon, 06 Jan 2020 12:52:39 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ioRs5-00034s-TV for pgsql-hackers@postgresql.org; Mon, 06 Jan 2020 12:52:39 +0000 Received: by mail-wr1-x442.google.com with SMTP id t2so49466246wrr.1 for ; Mon, 06 Jan 2020 04:52:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=+4zh8V6NgDvAHcYbOFOmNq+jK5rrO/t8iUtWkr6q3is=; b=Iz53PP3TKDbK8UKdg/P3Q3KUs6a65SQTuSQO0/e+rM//tPOEi6X4yoMPmGlflEgFva 1W7BwQJpLWfzlR4fag5U5PK/aU4a+Vd0h2Qr7tFtceLfCBYHsej0cpBCZM4+cAr3mfNb 6Wwg6FLSx35+kAmXo0XGIQNJK6vZRF2pcH3uXYDbnJhXrGCotRG7PII+vM4TGmteIyuf nMUAEg5/ro5pvDU7lFdDYfyYnRiunBQBuKEzsqJNAgncuqOE2PCc8q2Ad1KqiyIDVSzR oAHNCGqjcXe+m79qOOk1bOeouZ3VGK61tD9qMbQsDV4IPMx1rpeSozfU5BS6de5Y5+um V3bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=+4zh8V6NgDvAHcYbOFOmNq+jK5rrO/t8iUtWkr6q3is=; b=iGfht8KBqMGcycNI2O6RglFroNXKswV16SYVdUUvt5ARZwn8DrOU7SpBhkpeqvUwHV gLLOiIxz1g85KukAe2wbrEiYfGejj8dNd5kUW48aURCy/g44/VfiBrypo/opwdtrnE5o /x3SCt9Q3gz0hh7IGmW8b/jzJieMDof8CKuTjr7Fr3mpQPKan2kK4MJFeuw3Oen9itus hSAd0z2lklSaM6V4T1jxj0RBK8M69Z/6m9ZHVxoZbxh3s3W67ShAG0ZqQIgfKxnspspB +XsXLBo3F1ZhWqUMj75TVwiX52V0Jnv2dJJHdlZ7Bn5g58Zskj/5T0pEZ90pa6uELMi6 c+hw== X-Gm-Message-State: APjAAAXVejPvgOw1n6Th46xcux2fYQhBesbJppMAiPqSghNTfx3QrzIs EMuLpvZbxey9DuysWnxiGDOeUA== X-Google-Smtp-Source: APXvYqxJ7HbPCReLYLwfZ9AL+h/2mSEhPv6/4sDQoc38VHOQWVmZV7yT6uHxixcZ4JfHHtIBBjZtTA== X-Received: by 2002:adf:cf06:: with SMTP id o6mr102205173wrj.349.1578315156307; Mon, 06 Jan 2020 04:52:36 -0800 (PST) Received: from localhost (ip-86-49-253-92.net.upcbroadband.cz. [86.49.253.92]) by smtp.gmail.com with ESMTPSA id g7sm72578899wrq.21.2020.01.06.04.52.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jan 2020 04:52:35 -0800 (PST) Date: Mon, 6 Jan 2020 13:52:34 +0100 From: Tomas Vondra To: Dean Rasheed Cc: =?utf-8?B?5pu+5paH5peMKOS5ieS7jik=?= , Konstantin Knizhnik , Pavel Stehule , Robert Haas , PostgreSQL Hackers , =?utf-8?B?6JSh5p2+6ZyyKOWtkOWYiSk=?= , "Cai, Le" , =?utf-8?B?6JCn5bCR6IGqKOmTgeW6tSk=?= Subject: Re: [Proposal] Global temporary tables Message-ID: <20200106125234.p65hkqopbzkyrvio@development> References: <24099f4e-742c-e92b-729c-77bac1ca80d4@postgrespro.ru> <80cf30c2-ebd5-a568-9f62-a970e4d91326@postgrespro.ru> <5767433E-1A77-4682-B3FD-4869911021C8@alibaba-inc.com> <6b7570aa-14ea-2f28-c3b5-74dd785bbafe@postgrespro.ru> <20200105200603.wrb4beacwb57hhpk@development> <33969545-BEF7-4518-A741-302CBF7FF269@alibaba-inc.com> <20200106110119.zfrg2m5e2q5mvi5v@development> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Mon, Jan 06, 2020 at 12:17:43PM +0000, Dean Rasheed wrote: >On Mon, 6 Jan 2020 at 11:01, Tomas Vondra wrote: >> >> On Mon, Jan 06, 2020 at 01:04:15PM +0800, 曾文旌(义从) wrote: >> >> >2 We feel that gtt needs to maintain statistics, but there is no >> >agreement on what it will be done. >> > >> >> I certainly agree GTT needs to maintain statistics, otherwise it'll lead >> to poor query plans. > >+1 > >> AFAIK the current patch stores the info in a hash >> table in a backend private memory, and I don't see how else to do that >> (e.g. storing it in a catalog would cause catalog bloat). >> > >It sounds like it needs a pair of system GTTs to hold the table and >column statistics for other GTTs. One would probably have the same >columns as pg_statistic, and the other just the relevant columns from >pg_class. I can see it being useful for the user to be able to see >these stats, so perhaps they could be UNIONed into the existing stats >view. > Hmmm, yeah. A "temporary catalog" (not sure if it can work exactly the same as GTT) storing pg_statistics data for GTTs might work, I think. It would not have the catalog bloat issue, which is good. I still think we'd need to integrate this with the regular pg_statistic catalogs somehow, so that people don't have to care about two things. I mean, extensions like hypopg do use pg_statistic data to propose indexes etc. and it would be nice if we don't make them more complicated. Not sure why we'd need a temporary version of pg_class, though? regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services