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 1t8kgY-005mlI-MI for pgsql-general@arkaria.postgresql.org; Wed, 06 Nov 2024 18:23:18 +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 1t8kgV-00885P-Ly for pgsql-general@arkaria.postgresql.org; Wed, 06 Nov 2024 18:23:16 +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 1t8kgV-008846-A6 for pgsql-general@lists.postgresql.org; Wed, 06 Nov 2024 18:23:15 +0000 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t8kgS-000Y9v-11 for pgsql-general@lists.postgresql.org; Wed, 06 Nov 2024 18:23:15 +0000 Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-5ceb03aadb1so53052a12.0 for ; Wed, 06 Nov 2024 10:23:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=cybertec.at; t=1730917392; x=1731522192; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=vH5vv613BhvLovTavP8AXO6zN7GxFpxl4Ix2CRAJG+0=; b=cxU3b5dDf6XkjndZzf0xdVihr2D1FqOOUI3n5mfwWsk6awragn3PF431IqgaRbBXz4 4hXJgFiTj/b9JWsytuBs5OAYNegyHzj406XprJQFTpBNJBsfb1BVFiCsCjGXsMkO2lV5 MRWdIsZJgOPxsPcUPmWC6jvInYJAUH4gsiu1I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730917392; x=1731522192; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=vH5vv613BhvLovTavP8AXO6zN7GxFpxl4Ix2CRAJG+0=; b=xTgBM4mYMUYnarTASNcRPXZt0zy6xYwokGb21Ia50lkluNNxXGZyDsIEAPZHFyMIfL QLQT1x5MzrlRWFhMObMGYQOSOIl/qJIavoEs3nY+BouqTHBh6Al9M4BNh90jlKXhOvrV HrakgyPhwV5qcHVQl00Q/JR2tyLF0AZur7VwfpUTcTiTPU28ZCWuvAK302W8b6wD+eMY keoO10M1GZMovR5ml2KaVd+6ZCFqPpx4NMxP7iGGRemrox5SXiAF/Yhd0bE8bEimYI9S 48lV9JsBmOmHDnm7EQSyfXdRglgKWAsMP26nrrHRGIRp7NsABUInGCXUFEdPIOS3wbG3 B5eg== X-Forwarded-Encrypted: i=1; AJvYcCXP17axj2RoqV07KCDm1vgeCo93jLxSilCm6d8Qk3yzXa8LwN9/3209lgHOx3nGAHhbIwD2SVwkzgFCgkng@lists.postgresql.org X-Gm-Message-State: AOJu0Yy95V+5E2q+RHwsQA/Rv7eoNuBuAmEoyM3J8PpqE3pc8+9bHFKT BOyZLqSVJCSmf+IT5+ivJzFlJOWz4L546mDXmRFIHraHue/iFPQ1FQVcH+rtnK7jIdMbPwmXP/d ry2srqg== X-Google-Smtp-Source: AGHT+IFhbWyKbS/oi1EUJ21XnorP9YvkTD7UVmpm3AFmahaYHlLz6Uq3JY3zE6EXIKrp3qDMYcB1wA== X-Received: by 2002:a17:907:98d:b0:a99:f0d0:4ce3 with SMTP id a640c23a62f3a-a9e508e1d73mr2465677566b.17.1730917391716; Wed, 06 Nov 2024 10:23:11 -0800 (PST) Received: from localhost.localdomain ([46.226.60.98]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9eb16a2ec7sm320637366b.22.2024.11.06.10.23.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Nov 2024 10:23:11 -0800 (PST) Message-ID: Subject: Re: Performance Issue with Hash Partition Query Execution in PostgreSQL 16 From: Laurenz Albe To: Ramakrishna m , pgsql-general@lists.postgresql.org Cc: ravisql09@gmail.com Date: Wed, 06 Nov 2024 19:23:11 +0100 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.52.4 (3.52.4-2.fc40) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, 2024-11-06 at 22:43 +0530, Ramakrishna m wrote: > One of the queries, which retrieves a single record from a table with 16 = hash partitions, > is taking more than 10 seconds to execute. In contrast, when we run the s= ame query manually, > it completes within milliseconds. If I read your file right, the slow execution has an additional "LIMIT 55". That can make a difference. In general, you can use auto_explain to get the execution plan of the slow = query. Yours, Laurenz Albe