Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bU9oR-00072D-CR for pgsql-hackers@arkaria.postgresql.org; Mon, 01 Aug 2016 09:47:07 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bU9oQ-0001wS-O1 for pgsql-hackers@arkaria.postgresql.org; Mon, 01 Aug 2016 09:47:06 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bU9n3-0000IP-Tk for pgsql-hackers@postgresql.org; Mon, 01 Aug 2016 09:45:42 +0000 Received: from newmail.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bU9mw-0004Sn-HK for pgsql-hackers@postgresql.org; Mon, 01 Aug 2016 09:45:40 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id CA58C21C27BE; Mon, 1 Aug 2016 12:45:31 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru Received: from mail.postgrespro.ru ([127.0.0.1]) by localhost (mail.postgrespro.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2ncbNRvQuVJZ; Mon, 1 Aug 2016 12:45:31 +0300 (MSK) Received: from fujitsu (unknown [192.168.27.1]) by mail.postgrespro.ru (Postfix) with ESMTPSA id A132A21C27B1; Mon, 1 Aug 2016 12:45:31 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1470044731; bh=Tn1P2w6wKnaWwvSGhFIqaOsJyUYNvRCes9YyIkrLVR8=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=fV0KgtIQ8EiGxAb0+ne3s926oecZrFZ/sLn2IEqPonAczm8Lkt+DnavEO1sMMZ4sU HfKtvHuu4QI+dKmmPoauSLvuN4FSh4tSmqqbj5sGJeovGl2454rt/cbS5bzjP/jBX/ XmpuyvEbh0O3wCTPdA71KYRa28rDo2YZvnB2rrqs= Date: Mon, 1 Aug 2016 12:45:31 +0300 From: Aleksander Alekseev To: Tomas Vondra Cc: Tom Lane , Pavel Stehule , PostgreSQL Hackers , Tomas Vondra , David Steele Subject: Re: [Patch] Temporary tables that do not bloat pg_catalog (a.k.a fast temp tables) Message-ID: <20160801124531.66cde374@fujitsu> In-Reply-To: <5cdc3fde-d6a5-f0d2-b930-485bdcaecde5@2ndquadrant.com> References: <20160729141552.4062e19b@fujitsu> <39b0f423-a4df-3564-3b4a-b1de6f9eea80@2ndquadrant.com> <1184.1469890030@sss.pgh.pa.us> <5cdc3fde-d6a5-f0d2-b930-485bdcaecde5@2ndquadrant.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -3.2 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Hello. Thanks everyone for great comments! > Well, jokes aside, that's a pretty lousy excuse for not writing any > docs I think maybe I put it in a wrong way. There are currently a lot of comments in a code, more then enough to understand how this feature works. What I meant is that this is not a final version of a patch and a few paragraphs are yet to be written. At least it's how I see it. If you believe that some parts of the code are currently hard to understand and some comments could be improved, please name it and I will be happy to fix it. > IMHO if this patch gets in, we should use it as the only temp table > implementation (Or can you think of cases where keeping rows in > pg_class has advantages?). That'd also eliminate the need for FAST > keyword in the CREATE TABLE command. > Probably has zero value to have slow and fast temp tables (from > catalogue cost perspective). So the FAST implementation should be used > everywhere. If there are no objections I see no reason no to do it in a next version of a patch. > I'm getting failures in the regression suite I've run regression suite like 10 times in a row in different environments with different build flags but didn't manage to reproduce it. Also our DBAs are testing this feature for weeks now on real-world applications and they didn't report anything like this. Could you please describe how to reproduce this issue? > This should to work on slaves - it is one of ToDo Glad you noticed! In fact I'm currently researching a possibility of using the same approach for creating writable temporary tables on replicas. > The key reason why I don't think that's negotiable is that if there > aren't (apparently) catalog entries corresponding to the temp tables, > that will almost certainly break many things in the backend and > third-party extensions, not only user code patterns like this one. > In short, I think that the way to make something like this work is to > figure out how to have "virtual" catalog rows describing a temp table. I'm afraid once again I put it in a wrong way. What I meant by "Information about these tables is stored not in a catalog but in backend's memory" is in fact that _records_ of pg_class, pg_type and other catalog relations are stored in-memory. Naturally this records are visible to the user (otherwise \d or \d+ would not work) and you can do queries like ` select * from pg_class where relname = 'tt1' `. In other words part of the catalog is indeed "virtual". > I didn't see support for memory store for column's statistics. Some > separate questions is about production statistics - > pg_stat_user_table, .. > That seems to work (both analyze and pg_stat_user_tables). Not sure > where it's in the code, and I'm not willing to reverse engineer it. Right, `ANALYZE temp_table;` and everything else works. Besides pg_class, pg_type, pg_attribute and other relations pg_statistic records for temp tables are stored in-memory as well. IIRC a lot of pg_stat* relations are in fact views and thus don't require any special support. If you see that some statistics are broken please don't hesitate to report it and I will fix it. Hope I answered all questions so far. I look forward to receive more comments and questions regarding this patch! -- Best regards, Aleksander Alekseev -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers