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 1mKRXX-0004Lv-6k for pgsql-general@arkaria.postgresql.org; Sun, 29 Aug 2021 20:36:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mKRX0-0000uD-10 for pgsql-general@arkaria.postgresql.org; Sun, 29 Aug 2021 20:35:54 +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 1mKRWz-0000u4-Mh for pgsql-general@lists.postgresql.org; Sun, 29 Aug 2021 20:35:53 +0000 Received: from mail-qk1-x735.google.com ([2607:f8b0:4864:20::735]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mKRWw-0000Nz-PT for pgsql-general@lists.postgresql.org; Sun, 29 Aug 2021 20:35:52 +0000 Received: by mail-qk1-x735.google.com with SMTP id a66so13528184qkc.1 for ; Sun, 29 Aug 2021 13:35:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=v92ozXo6JbujG8Z7q5NZSWvRtJhppMX9gjKScc+m7vU=; b=HHE2X4hb5UiM8/9FjtyKBN9l8+tAulOKJei8X2Kv77uZffQjwHK9UlT58P3prwQ8zk 8Xqx05jvrL1JYf5P8NU60OHtE9YWrwTF0b79GfB0I4hufxPV6C8I2FjlEBjTlxyojlcr bvYBgeXRDb9fSXyYFY5zHzMWtJ4lCk6uKrN9i67Vo3G1bWhicPCaWsSbodiuMvHlvYzP 4uIrr+ufIZ38ZLqqX+Uo35DRCBOtldqDXINyj1LjWhDTjPBdgJ3fa05L2ixyLVNfzJw1 KQ9nXnCHDS5i6jGwyBPndXjWCeab1uoUm0pTCztCceWhNIJ4dEnoIU7Zez06KVs2H1hk fLmw== 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:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=v92ozXo6JbujG8Z7q5NZSWvRtJhppMX9gjKScc+m7vU=; b=XdvcaxDWhcGs7xGdhmwz5/HhCwiSvdyIAcnL9gowkIcA0OnIX1zRJlKmA7JFbQueCE +bCF3ynq53q+zv2Rj+xJeO5rP/4KIxj6CkVqmnaJAzE0DUVHmGNcls6c3aC1nXI1OxZN xsGyrAWb8ORMY17rwbt3MQE1fnw2qWpUZ3kMkMEgtrDn+uIg6pTGv2Mx90p2hz+aQ0PU QMSL9lcbs618S5etBMBXmM4vLvxM702rDiVSs/IjJ0xjN4UZxBTyiQNSgCh2iSxzZ+mF DQ8gAiq/9kDyS5pBJWCH1rid2P7cSCbBC6qmZ/Gm6Dj/cVkeK1gFOBI242fCy6Rm8VmP UYww== X-Gm-Message-State: AOAM533/DPaw5PAIzUq7IJN+Vu9VpyMQa5DN5V2P37zoPRs5nIC+yhst 6d4LcspHkUzMECG3G+rR9cH1Jwd15/6HYQ== X-Google-Smtp-Source: ABdhPJyds7QBsXj/oHiA2OJfvZwpXa4M34ejCt8LfGm33Qk2TY6R1BPqGU2lbXMHx0YOG5LRsWHm9g== X-Received: by 2002:a05:620a:2223:: with SMTP id n3mr19282387qkh.66.1630269348041; Sun, 29 Aug 2021 13:35:48 -0700 (PDT) Received: from [192.168.2.100] (pool-100-8-54-81.nwrknj.fios.verizon.net. [100.8.54.81]) by smtp.gmail.com with ESMTPSA id e15sm1033099qtp.33.2021.08.29.13.35.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 29 Aug 2021 13:35:47 -0700 (PDT) Subject: Re: database design with temporary tables To: Adrian Klaver , pgsql-general@lists.postgresql.org References: <0e9373c9-565c-5edb-5c71-b3ea40be9473@aklaver.com> From: Mladen Gogala Message-ID: Date: Sun, 29 Aug 2021 16:35:47 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 8/29/21 2:26 PM, Adrian Klaver wrote: > The pool is maintained, the individual connections(sessions) come and > go. Otherwise there would be no point to having a pool. Every time the > connection(session) is closed the temporary table disappears. Yes, you're right. And that is very convenient. I also prefer temporary tables with ON COMMIT DELETE ROWS so that I don't have leftovers between transactions. There is also pgtt extension by Giles Darold which emulates Oracle global temporary tables: https://github.com/darold/pgtt#use-of-the-extension I have never particularly liked Oracle's implementation of temporary tables, local or global,  so I have no problems with questions like that. BTW, I have compared Oracle's implementation with other implementations here: https://dbwhisperer.wordpress.com/2019/03/18/private-temporary-tables-oracle-18c/ I could have used Postgres instead of the SQL Server, the comparison would read the same, except for the "#" character which denotes temporary table in SQL Server. Regards -- Mladen Gogala Database Consultant Tel: (347) 321-1217 https://dbwhisperer.wordpress.com