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 1tM1IB-0016nV-KN for pgsql-hackers@arkaria.postgresql.org; Fri, 13 Dec 2024 08:44:59 +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 1tM1I8-003IB1-Md for pgsql-hackers@arkaria.postgresql.org; Fri, 13 Dec 2024 08:44:57 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tM1I8-003I9w-Bh for pgsql-hackers@lists.postgresql.org; Fri, 13 Dec 2024 08:44:57 +0000 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tM1I2-002aKP-SQ for pgsql-hackers@lists.postgresql.org; Fri, 13 Dec 2024 08:44:56 +0000 Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-5d3ecae02beso1912178a12.0 for ; Fri, 13 Dec 2024 00:44:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734079489; x=1734684289; 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=xkshItRSxIl6X3jbQJ29Lauo3NiIcxuz2jE9E2PhxlU=; b=gJ33GCb2oDrtL2rMJ3x1SpLwYsb/Hf+CAZxmzeS8sHt8bWpm2IvIr+25pM1NCNUMJ4 mGytxDtntcTGrwkdLq6rYS5vkehRC4IxRRqURmKIAFGU6S2Wcn1r8IvvfRYz4BuUnU8u kDgOp3BGzBM8zZ21An3qrNenEPfzT0A3RVdFB3d+SYlHTWoAUNIYlF2/V7DJgYDRiBnC XnskXbZAhYbPLk0UQMzQ5HQyCzpy+N9k/a7a/SeJNBojebDdyMm3QEC1xmfaKd1IAKWO 5quSSWw6ITDAUgnoPxjozmXBNA8+zGui81b2oR/0ZFh4c2RxRHn7WYcsK4206LSNRJz/ 2wYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734079489; x=1734684289; 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=xkshItRSxIl6X3jbQJ29Lauo3NiIcxuz2jE9E2PhxlU=; b=GtwpWW1srRnFXhTzO0M0F+j56BpvaL0JDr/orxd6kowCqsWhjIz4wCMWXlkiloTSGC 9RIGJw1mRXIyqnl8/6NF0kJzK/EwwW2gNX55FwbwJsgYSgWV6G+JPaqcNnZaaApFTjtY h387KFX7GTT3oFqGN9BFKjuI9VJQimEqUnPbv3Nz/M4GwRLZVg32I6Mf7kIsFyuDmMng EdS1dPDAGIjZQyuA+J9K6KjoIVdSktS+UGP7Ghav3S/c6TJ34h76O2aNfW77APkyLmOZ JP1Yv0K16jYlRAVtVH2A4rjyx/7KSwgG89PoyzcN7bdHalDXRQqxHG1bntwOxlIRSbuA 0otQ== X-Forwarded-Encrypted: i=1; AJvYcCU7lV/R4NFMFq7gCdnl+ZVfPptQjNBKskKot9whAcZvyO7NTl7BIbhntFnxijVqiNqYZclJYGfrnH7bOogY@lists.postgresql.org X-Gm-Message-State: AOJu0YxM3RZEm3Mu/W2VIrpwvppJVWEI2qHeTSRFJOahp2+M2tZsJSPu 07GjO3gWKEJArpSRXozWshm53//7U8OOW0SVZoxfru/QAYqg78YRekWQYWmz5TRympx0rul/SaW pqra4GHl/3QAYLZr4OHFd7aWHs9A= X-Gm-Gg: ASbGncv3+U9tITPw+AUffUQMtiLaqDnPL+zG8eXt3cutIn8dkFwYu2HMYdeJkcLmhlu oSxmQjzB1aPzuakRwMDneZ31vvopH5GiIZitn+rgU+5wMe+ztsHcAEE0ufTRJNReg X-Google-Smtp-Source: AGHT+IF73NZkEsqMlyCIWJ1G6Nep0mloJcUTVC6tdwGsSRuIHutl0+SmJlAVJ2txy0tThfG+vPtoEWzPuzcWQIjvBa8= X-Received: by 2002:a05:6402:3713:b0:5d2:7373:a810 with SMTP id 4fb4d7f45d1cf-5d63c320e82mr1484679a12.17.1734079488898; Fri, 13 Dec 2024 00:44:48 -0800 (PST) MIME-Version: 1.0 References: <202412121209.4xewo2lfsuld@alvherre.pgsql> In-Reply-To: <202412121209.4xewo2lfsuld@alvherre.pgsql> From: Yuya Watari Date: Fri, 13 Dec 2024 17:44:11 +0900 Message-ID: Subject: Re: [PoC] Reducing planning time when tables have many partitions To: Alvaro Herrera Cc: Ashutosh Bapat , Dmitry Dolgov <9erthalion6@gmail.com>, PostgreSQL Developers , jian he , Alena Rybakina , Andrei Lepikhov , David Rowley , Thom Brown , Zhang Mingli , Tom Lane 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 Hello Alvaro, Thank you for your reply, and I'm sorry if my previous emails caused confusion or made it seem like I was ignoring more important issues. On Thu, Dec 12, 2024 at 9:09=E2=80=AFPM Alvaro Herrera wrote: > > I'm repeating myself, but I disagree that this is something we should > spend _any_ time on. Developers running assertion-enabled builds do not > care if a complicated query with one thousand partitions is planned in > 500 ms instead of 300 ms. Heck, I bet nobody cares if it took 2000 ms > either, because, you know what? The developers don't have a thousand > partitions to begin with; if they do, it's precisely because they want > to measure this kind of effect. This is not going to bother anyone > ever, unless you stick a hundred of these queries in the regression > tests. In regression tests you're going to have, say, 64 partitions at > most, because having more than that doesn't test anything additional; > having that go from 40 ms to 60 ms (or whatever) isn't going to bother > anyone. I agree that focusing too much on assert-enabled builds is not productive at this point. In my last email, I shared benchmark results for debug builds, but I understand your point that even a few seconds of regression is not practically important for debug builds. For context, there have been reports in the past of minute-order regressions in assert-enabled builds (100 seconds [1] and 50 seconds [2]). I mentioned these minute-order regressions not to refocus the discussion on debug builds right now, but to clarify why we have been concerned about them in the past. I should have shared this background and done appropriate benchmarks (not millisecond regressions, but minutes). My sincere apologies. Once we have addressed the primary goals (release build performance and memory usage), I will revisit these regressions. > If anything, you can add a note to remove the USE_ASSERTIONS blocks once > we get past the beta process; by then any bugs will have been noticed > and the asserts will be of less value. Thank you for your advice. I will consider removing these assertions after the beta process or using OPTIMIZER_DEBUG, which is Ashutosh's idea. > I would like to see this patch series get committed, and this concern > about planning time in development builds under conditions that are > unrealistic for testing is slowing the process down. (The process is > slow enough. This patch has already missed two releases.) Please stop. I will speed up the process for committing this patch series. > Memory usage and planning time in production builds is important. You > can better spend your energy there. As you said, we have another big problem, which is memory usage. I will focus on the memory usage problem first, as you suggested. After fixing those problems, we can revisit the assert-enabled build regressions as a final step if necessary. What do you think about this approach? [1] https://www.postgresql.org/message-id/d8db5b4e-e358-2567-8c56-a85d2d801= 3df%40postgrespro.ru [2] https://www.postgresql.org/message-id/CAExHW5uVZ3E5RT9cXHaxQ_DEK7tasaMN= %3DD6rPHcao5gcXanY5w%40mail.gmail.com --=20 Best regards, Yuya Watari