Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fOsJj-0000h8-4Z for pgsql-general@arkaria.postgresql.org; Fri, 01 Jun 2018 22:14:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fOsJh-0001mT-NN for pgsql-general@arkaria.postgresql.org; Fri, 01 Jun 2018 22:14:37 +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_SHA384:256) (Exim 4.89) (envelope-from ) id 1fOsJh-0001mJ-FH for pgsql-general@lists.postgresql.org; Fri, 01 Jun 2018 22:14:37 +0000 Received: from mail-io0-x233.google.com ([2607:f8b0:4001:c06::233]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fOsJd-00020x-Cl for pgsql-general@postgresql.org; Fri, 01 Jun 2018 22:14:36 +0000 Received: by mail-io0-x233.google.com with SMTP id d185-v6so3433803ioe.0 for ; Fri, 01 Jun 2018 15:14:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:subject:message-id:mime-version:content-disposition :user-agent; bh=o3XzmMALZp3zgQR8DAlVRwcEaMbdp7x6smYWpmj7UII=; b=UzcnjmbTPLvdoFGQzXdsiTIQFt2pfwOuj5cs/YlRShxwaM6rES0gHtkjWRol+daoJ5 9+guGgaG1OmA5nI0Cnbi5sBrqt7Vd1kPmjHJkoUG5jfGhWhzQpn75q1cBpa18yyPO22u AJCzScdU5OJrJmafuo16ZAKxWv8Wm68ACitO/+r25QJ2T2ivvpmBKjWQSKqcA9HYLnXE sgdKqZQAKnyPrPpKzlhBZEO1Pqkz3qXQ0eK5tRp8IjpaUJ3ebeDBR+V3br3EYUqGLE9D wWL4S2qyJSGbi1qxc2buaZ2DXyJ2KCiDskYwuNd2BpJJHKycdGJLEfpC8VwHRTvsUMtU G+Gw== 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:subject:message-id:mime-version :content-disposition:user-agent; bh=o3XzmMALZp3zgQR8DAlVRwcEaMbdp7x6smYWpmj7UII=; b=CPA8IVIKMv/Pf6wpJmMiMuw9sz3vBJXzGZAUW6ABBYcBPbwguJDsQ/L+9W69KRAvz/ 1OFZDMViccwR+f0exQ33y4vfIA2HHu3ZL4wCr60mkf68ov5+yyUGqYHlU8cgxHP3OSYJ mvxVKYxNNFJNx7VsL/S/I1ZzX/NWFciwSnLehklCsudnmwbDocPd6jl1mz9YYSRGP4yZ OxUhbXrGEXTz29tOIYNqPg+45MrcdIj741zJFf//ZIjfecPEapNlO4uRKStsj1e19Ery gEngswwRIv5HtH7M7xEIsqjLKvvHSmTWLlB6VTIDz/48g66rdCWN32fY5KwDQe0x4aVp 8KYA== X-Gm-Message-State: APt69E2BFV97WomnkiIaxb2qfaxB4ipLPBEmGqPNTzbl9qnGuTAR6YXT c/oo8b1dyMSJ0EDa5ysk833Clakaqeg= X-Google-Smtp-Source: ADUXVKLUpUhnwgvzN1RhGKHp5zgrOrQDphknoyURpcRboeJ4tjzjVKniPNwiTvtvLpyk9j161chQfw== X-Received: by 2002:a6b:2bcb:: with SMTP id r194-v6mr11767795ior.180.1527891270966; Fri, 01 Jun 2018 15:14:30 -0700 (PDT) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id y204-v6sm2666320ioy.88.2018.06.01.15.14.30 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Jun 2018 15:14:30 -0700 (PDT) Received: by pryzbyj (Postfix, from userid 1000) id 3ABE080173B; Fri, 1 Jun 2018 17:14:29 -0500 (CDT) Date: Fri, 1 Jun 2018 17:14:28 -0500 From: Justin Pryzby To: pgsql-general@postgresql.org Subject: notes from transition to relkind='p' Message-ID: <20180601221428.GU5164@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Before I forget any more, this is a brain of issues/considerations/concerns with our (partial) transition to partitioned tables over the last ~9 months. I believe these are all documented behaviors, but could be seen by users as a gratuitious/unexpected change or rough edge and the differences could perhaps be mitigated. I realize there's maybe no good time or way to change most of these, but maybe the list will be helpful to somebody in avoiding unexpected transitional issues. . DROP TABLE on a parent no longer fails without CASCADE (dependencies of relkind='p' are deptype='a' "soft" dependencies) 8b4d582d279d784616c228be58af1e39aa430402 . ANALYZE relkind_p also updates stats of child (whereas ANALYZE relkind_r only updates stats for parent); it's unclear if there's any reason why it wasn't always done this way(?). I end up having to conditionize processing based on relkind. 3c3bb99330aa9b4c2f6258bfa0265d806bf365c3 . The docs say: if detaching/re-attach a partition, should first ADD CHECK to avoid a slow ATTACH operation. Perhaps DETACHing a partition could implicitly CREATE a constraint which is usable when reATTACHing? . relkind_p has no entry in pg_stat_user_tables (last_analyze, etc). Maybe the view could do the needed CASE ... (SELECT min() FROM pg_inherits JOIN psut) . ALTER TABLE ATTACH requires specifying bounds: Maybe it sounds naive to suggest one would want to avoid that; but consider: we ended up adding both shell and python logic to parse the table name to allow detaching and reattaching partitions. I think it'd be a nice if the bounds were inferred if there was a single constraint on the partition key. . ALTER TABLE ATTACH has reversed order of child vs parent relative to NO/INHERIT. . And actually, having both ALTER TABLE DE/TACH vs NO/INHERIT is itself messy: we ended up having branches (both shell and python) to handle both cases (at least for a transitional period, but probably we'll need to continue handling both into the indeterminate future). Cheers, Justin