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 1oWGbm-000371-J4 for pgsql-hackers@arkaria.postgresql.org; Thu, 08 Sep 2022 12:26:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oWGbl-0002fS-7g for pgsql-hackers@arkaria.postgresql.org; Thu, 08 Sep 2022 12:26:13 +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 1oWGbk-0002fI-Rz for pgsql-hackers@lists.postgresql.org; Thu, 08 Sep 2022 12:26:12 +0000 Received: from mail-io1-xd2a.google.com ([2607:f8b0:4864:20::d2a]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oWGbf-00064b-30 for pgsql-hackers@lists.postgresql.org; Thu, 08 Sep 2022 12:26:11 +0000 Received: by mail-io1-xd2a.google.com with SMTP id c4so13896382iof.3 for ; Thu, 08 Sep 2022 05:26:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date; bh=Idf+RKv9nZnvy2FA6bTdX6820dgWvfNHS5DRqbiIqlk=; b=cYwNIZFeP1kGdOoH/xGzhXIk02petZblYI06MLHNDomCEhi95p08Ve5bc2B5qBbji/ OrQlusQCa1w+TiR5oR5PipTOFtN39QosZ3KLVBEGwY/k6oGthS9hRhpL4JJeUXO+J93D 7QN7UtsQa4ysxPM03ErKLuIaanqeZv6qmPyE5eE9i7NXDI6rTa11jtONLNNczvDgQvI6 gDF2XEg5dT7hOFgKMYwRFJG5nFCJofHIUNH4bCVdNxa0W7/pJ9ebY6TTE+wCsGFNdK5u eRU/3qv8tfYFgISghzG8Anb2+j+aCJmsP/35cRS6ipwHNbyGO8AxPu5j9xYTCJUL1Oh8 BAlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date; bh=Idf+RKv9nZnvy2FA6bTdX6820dgWvfNHS5DRqbiIqlk=; b=yfHX5mRmOgJ6McqYjtYpF1YJo815UUc6He1DjXT1MRUAlZmJt0jmdQevTnIBg0iY+Z Y59m+I+S0teNa6IfgsmIjtWhYjqc/WwL+e+2+pWUk98hSI13hVmZlB25xx8gxiElw4TE zPivLcp+FoyGeCg/zzw0nh+S+qlMx9FCFFmRDP9XDJuOH5yVesK4OIcpJ09OtJn4kBNn FTaOrZGFnMVaUtJ77X1wRKUQeEiXBYXV6HcHMDfVLsnAuM8OkoxVkRwZU/l3+4QwoZ+J zdGWMWG3OwrXaMBUW4yQx6g93Zn8MXW6UyfTQDFneOepGVZLQd+eDdJnqYJnEODV6fFC bkyA== X-Gm-Message-State: ACgBeo1+ZjdoPQuUHiAY2lL51dHCqamGcCYZ36D2POlBFrSXOHzk6nzD 4oZ50W/19pWs31YPrxcPoY5r+Jh8Pulftg== X-Google-Smtp-Source: AA6agR5xqEp/SJxN1IvZQeVSIhOY1THOeOZfeg6tFruhZ2T4XbvI89zY9f+gOgDMDN2CO87dVJeVNA== X-Received: by 2002:a05:6638:3282:b0:33f:6ed0:4c83 with SMTP id f2-20020a056638328200b0033f6ed04c83mr4825475jav.96.1662639966079; Thu, 08 Sep 2022 05:26:06 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id t13-20020a056602140d00b00689e718d971sm978838iov.51.2022.09.08.05.26.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Sep 2022 05:26:05 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 5D26E800785; Thu, 8 Sep 2022 07:26:04 -0500 (CDT) Date: Thu, 8 Sep 2022 07:26:04 -0500 From: Justin Pryzby To: Dmitry Koval Cc: pgsql-hackers@lists.postgresql.org Subject: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands Message-ID: <20220908122604.GE31833@telsasoft.com> References: <20220714081214.s7cie3vbtyyshzuz@alvherre.pgsql> <5baa51c4-ee85-337a-6932-9fe8a85a1fed@postgrespro.ru> <87dd2e43-5a16-f2b9-4ab9-76a6d35f246f@postgrespro.ru> <20220907184333.GC31833@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Sep 08, 2022 at 02:35:24PM +0300, Dmitry Koval wrote: > Thanks a lot Justin! > > After compilation PostgreSQL+patch with macros > RELCACHE_FORCE_RELEASE, > RANDOMIZE_ALLOCATED_MEMORY, > I saw a problem on Windows 10, MSVC2019. Yes, it passes tests on my CI improvements branch. https://github.com/justinpryzby/postgres/runs/8248668269 Thanks to Alexander Pyhalov for reminding me about RELCACHE_FORCE_RELEASE last year ;) On Tue, May 31, 2022 at 12:32:43PM +0300, Dmitry Koval wrote: > This can be useful for this example cases: > need to merge all one-day partitions > into a month partition. +1, we would use this (at least the MERGE half). I wonder if it's possible to reduce the size of this patch (I'm starting to try to absorb it). Is there a way to refactor/reuse existing code to reduce its footprint ? partbounds.c is adding 500+ LOC about checking if proposed partitions meet the requirements (don't overlap, etc). But a lot of those checks must already happen, no? Can you re-use/refactor the existing checks ? An UPDATE on a partitioned table will move tuples from one partition to another. Is there a way to re-use that ? Also, postgres already supports concurrent DDL (CREATE+ATTACH and DETACH CONCURRENTLY). Is it possible to leverage that ? (Mostly to reduce the patch size, but also because maybe some cases could be concurrent?). If the patch were split into separate parts for MERGE and SPLIT, would the first patch be significantly smaller than the existing patch (hopefully half as big) ? That would help to review it, even if both halves were ultimately squished together. (An easy way to do this is to open up all the files in separate editor instances, trim out the parts that aren't needed for the first patch, save the files but don't quit the editors, test compilation and regression tests, then git commit --amend -a. Then in each editor, "undo" all the trimmed changes, save, and git commit -a). Would it save much code if "default" partitions weren't handled in the first patch ? -- Justin