Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rtERJ-00DKVh-2d for pgsql-hackers@arkaria.postgresql.org; Sat, 06 Apr 2024 22:23:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rtERH-00HOpN-MZ for pgsql-hackers@arkaria.postgresql.org; Sat, 06 Apr 2024 22:23:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rtERH-00HOpB-Cy for pgsql-hackers@lists.postgresql.org; Sat, 06 Apr 2024 22:23:07 +0000 Received: from mail-yb1-xb2b.google.com ([2607:f8b0:4864:20::b2b]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rtERE-001AQM-S5 for pgsql-hackers@lists.postgresql.org; Sat, 06 Apr 2024 22:23:06 +0000 Received: by mail-yb1-xb2b.google.com with SMTP id 3f1490d57ef6-dcc71031680so3216364276.2 for ; Sat, 06 Apr 2024 15:23:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712442183; x=1713046983; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=J4+QmAc0jKPT2bvxRd16/daWmnA5cyC1w5aNQXa7r8E=; b=fVtPAsHpxHKzvRAJfIuxB3e5bpwhYPHzDMTYrKgCyvf0a4qDm59iKQLqwcO5bvtyRH hSBxoXvG6wCixTxfWJc62Fx8oFsSb4mHBMa8HPC1gBy/vxaP6/MLYqYPvFDzNni0+XN/ xqGGuix8XR7r7m95gipulsx+1Ak1oBs9kAlRmtWYExiw5QroMCErTIc8tJLpeY2lOqXD 9mhIVfLbpWFF/59qOgrbG8xI8vDOJEY1wqMMMysbUSffL18WIFAbLiF5QTYyOlCSA4OC 13PTiXDwYb/J1MJDM4pF1dOblN4SMeFQdhNsfh0FfcjUfGtIbhYVs6QZltgrsugWKCDJ CRcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712442183; x=1713046983; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=J4+QmAc0jKPT2bvxRd16/daWmnA5cyC1w5aNQXa7r8E=; b=U86+z1KI92nD/UIWl55LHpB7xh7XR8h57oJEiFilaNhWujeS+Z6yOzI5oRJEAiL6z3 bHRyIdiO1iA9q6Q7MOqGoErBJyXnIa0yQEBHoMHyukdS3MzRRpldfOo9tGY1Q4EPFrc9 kWmUfTJ8myHt2VS2c562V3fNUhPt1Ys8dugrYLCXEXc+1Caen1Ikv/Kx2zJUVrrkxKxm qBObQpcwYca3/Ezg+DjF6QVUr0FmS9xtL+Ecxknez+nDvhvkO87mS5QNY81iqWlRj0Ex OyFeBbZvrShcg+6Gq1XXwH5qwXVB9/ySmbK6vS5ajgG5XVGGNJOJrarBBo57KZ2AborQ jW1A== X-Gm-Message-State: AOJu0YzNXIkWOZ1fgItK3aNoxpBiJBnm6J50+kdsXNRklDF67uGiRpNs gGD/UCgKU7kyDdFfUtS/6gvdBh6ceqMavqnsDv8Ze+ApS5a6euRUdlYf0mCOF5pfJKwxEvOMDbh F3s+e9joWbmsBzALr81AvscnxVYdYQfeABT4c8A== X-Google-Smtp-Source: AGHT+IHhS+w8tGZ+HnNgi+UvsCnTUkRKoKoFxR6/yugNHyotzaOxraVoRnNIqdihfTuGp4agQtsuwizPE72N7SeubX0= X-Received: by 2002:a05:6902:1005:b0:dcb:ce4a:bc2b with SMTP id w5-20020a056902100500b00dcbce4abc2bmr4831738ybt.51.1712442182874; Sat, 06 Apr 2024 15:23:02 -0700 (PDT) MIME-Version: 1.0 References: <171085360143.2046436.7217841141682511557.pgcf@coridan.postgresql.org> <171085858750.2046434.12246066729700037354.pgcf@coridan.postgresql.org> <909e16b4-9eda-435c-b033-8294ae4adc05@postgrespro.ru> <3a4b9c1c-3edf-4e29-9629-b4113aefb0f3@postgrespro.ru> In-Reply-To: From: Alexander Korotkov Date: Sun, 7 Apr 2024 01:22:51 +0300 Message-ID: Subject: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands To: Dmitry Koval Cc: pgsql-hackers@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, Dmitry! On Fri, Apr 5, 2024 at 4:00=E2=80=AFPM Dmitry Koval wrote: > > I've revised the patchset. > > Thanks for the corrections (especially ddl.sgml). > Could you also look at a small optimization for the MERGE PARTITIONS > command (in a separate file > v31-0003-Additional-patch-for-ALTER-TABLE-.-MERGE-PARTITI.patch, I wrote > about it in an email 2024-03-31 00:56:50)? > > Files v31-0001-*.patch, v31-0002-*.patch are the same as > v30-0001-*.patch, v30-0002-*.patch (after rebasing because patch stopped > applying due to changes in upstream). I've pushed 0001 and 0002. I didn't push 0003 for the following reasons. 1) This doesn't keep functionality equivalent to 0001. With 0003, the merged partition will inherit indexes, constraints, and so on from the one of merging partitions. 2) This is not necessarily an optimization. Without 0003 indexes on the merged partition are created after moving the rows in attachPartitionTable(). With 0003 we merge data into the existing partition which saves its indexes. That might cause a significant performance loss because mass inserts into indexes may be much slower than building indexes from scratch. I think both aspects need to be carefully considered. Even if we accept them, this needs to be documented. I think now it's too late for both of these. So, this should wait for v18. ------ Regards, Alexander Korotkov