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.96) (envelope-from ) id 1vfail-0039t0-1U for pgsql-performance@arkaria.postgresql.org; Tue, 13 Jan 2026 09:29:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vfaik-003oOa-2G for pgsql-performance@arkaria.postgresql.org; Tue, 13 Jan 2026 09:29:50 +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.96) (envelope-from ) id 1vfaik-003oOQ-1B for pgsql-performance@lists.postgresql.org; Tue, 13 Jan 2026 09:29:50 +0000 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vfaii-000AnX-0o for pgsql-performance@postgresql.org; Tue, 13 Jan 2026 09:29:49 +0000 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-43246af170aso3499909f8f.0 for ; Tue, 13 Jan 2026 01:29:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768296588; x=1768901388; darn=postgresql.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=yLtIjz9lgVgFkXsL/CgvhNkc4Sz0dh0T6Vc02vdRqgg=; b=QmIza1zqxiNuZaK5wXyHEhNJZ8nXaBTy2WX/W023XNUBt5CSKOIdOcnBlk7TdMdE7D gUWQGUKN3QBH/UZrrHlvjQkmj/F8QE24Pa9jY2AZ13czSgSIEtSy6FSEwqpvhJW1A0+P R9vsKWmwxI3vrOTFF7cdASYeMsLAx8pkaCdr9zvgQSP+y/EN3rw58OeWcfC3/Of9qPGh zuH4brRw0hYKC/lXCEvDj5nGLZ6gW77aF82pM/p6qj1FigtlwYgajDyDaNexPPy8t902 CaOXOTQYEuHO9ZinAKHoiKIMykpSm6NvVC7IuZcz59LBq1i0Lfdz9pgB7FUcjFyTbMQM QfLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768296588; x=1768901388; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=yLtIjz9lgVgFkXsL/CgvhNkc4Sz0dh0T6Vc02vdRqgg=; b=sLx5Du7VGvrJBEOy4iyW6BgYAhmo5+UcMcpdjsGGVBlMWBf/c6D1Sl77EdyupnZo4r +YYVlpFrpY8+qNnaOwySqZCLGrpyIyGNkh+VBbFlELO6g31RTDQkyO6Obo9CeLGHmnnd v2UBc3Cwe3C+gbiLtGMRWxD49M/kmYJaPHVEt5UMvR6nrYGebj+VFG4pQbTPAC3blKXu Qtm/TlI+NPwXOfulReJylDrYBZIzab6qsVr6EDCUHAz4Ngw5xvXs7jVCrfvRRhhJxTcL gqeQHHTHVoYW9j6RvV6H/AepIjVzbgNl6dl0iSBUu7tbv5JkJqu5EKadJGByr0cty6mi xmoQ== X-Forwarded-Encrypted: i=1; AJvYcCWl0QhSiCUvwLqeVVKUapL9o1ZjwkPvh0PYOLtK1fDxCu+2vR5cLxL7r0rF5Q4gZfa7QWY7KGFvlyDZTVZ6BxT+0Q==@postgresql.org X-Gm-Message-State: AOJu0YxgEgf6KFFoKUwRv8EIZ5fVKpzuZUo5nPO4BVjTS7pnkv82Xmn9 EGuGo6P6GSWqwfsDtLt36CEksJwqX42NiecKfUm6nZBjI0q3+gs8nzwh X-Gm-Gg: AY/fxX4P92xcYHeonJq/pGAybf3No6HDyPRP1JAzor38TY9NaUhKa/nx2hKv8fpWHZ4 4GtsyyA/HMY8v6Kc8YsQyoEk1Lj+Ep3T+CMH/h4hYED7yEOayLX1L6p5g8wQ1gn95D1AKZn9Mbj ii+Ik/UniXpHtvpptUAClCwmvbjwZZNc73v9+pOBtI7QG+I0UCN19MECw3zlfNCzRgJJPQasweJ 880qMVXYCFVjwzU42C3t1g4WCEPDiCO9ADIoH/FijD8FeatzHF4eLs0vxEK2hn8X+fyd9Zym7cu hgwwSaE1hAdnF0rhJgVkQJ1cy+2Ee6tLPceQOHjYwWYyxvXtG+TRXskGYi30rdzrEm9p5uMB1fh ICx3A1TmS0Ea2UzMltJgX2DKiTx9F8iqGtzu96/gNVu7Yc4OFXw7TZK7AZqCpe9S4JnvvgC3G9r j8XdQ2d45Qm3pn/Vo95fghJc7JRw== X-Received: by 2002:a05:6000:4027:b0:431:771:a50c with SMTP id ffacd0b85a97d-43423e74227mr2598029f8f.1.1768296587498; Tue, 13 Jan 2026 01:29:47 -0800 (PST) Received: from [192.168.15.190] ([80.251.191.198]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-432bd5df90dsm43410878f8f.20.2026.01.13.01.29.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 13 Jan 2026 01:29:46 -0800 (PST) Message-ID: <4f462695-5716-408a-a08a-8ba5e665bb9a@gmail.com> Date: Tue, 13 Jan 2026 10:29:45 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: small database huge planning time To: Alexander Kulikov , pgsql-performance@postgresql.org References: Content-Language: en-US From: Andrei Lepikhov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 13/1/26 10:16, Alexander Kulikov wrote: > Hello! > > > I have got huge planning time for a query in quite small database in PortgreSQL 17 > Planning Time: 452.796 ms > Execution Time: 0.350 ms > > Tried several version from 17.3 to 17.7 (cpu 2.2GHz) - it almost does not matter. If I run query many times in row planning time may reduce down to 430ms but never less. > > Tried in PortgreSQL 11 (in a little bit different hardware with cpu 2.60GHz) - planning time almost ten times less. > > Changing parameters: from_collapse_limit, join_collapse_limit, geqo, jit, work_mem and many > others does not help at all. I attach 1. additional setting in the > postgresql.status.conf. 2. querry itself in query.sql. 3. zql plan in > query.sqlplan 4. additioanal information about os, tables etc. would you May you attach the same EXPLAIN for the 'good' execution? Is there any chance to get the schema definition as a SQL script (ideally, without/replaced mvarchar fields)? Is it reproducible on a database with empty tables? -- regards, Andrei Lepikhov, pgEdge