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 1vOGK0-00HX1b-1w for pgsql-general@arkaria.postgresql.org; Wed, 26 Nov 2025 14:16:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vOGJz-00GwtL-04 for pgsql-general@arkaria.postgresql.org; Wed, 26 Nov 2025 14:16:39 +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.96) (envelope-from ) id 1vOGJy-00GwtC-25 for pgsql-general@lists.postgresql.org; Wed, 26 Nov 2025 14:16:38 +0000 Received: from mail-oi1-x232.google.com ([2607:f8b0:4864:20::232]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vOGJw-001cOV-2J for pgsql-general@lists.postgresql.org; Wed, 26 Nov 2025 14:16:38 +0000 Received: by mail-oi1-x232.google.com with SMTP id 5614622812f47-450ccefe573so3004009b6e.3 for ; Wed, 26 Nov 2025 06:16:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764166594; x=1764771394; darn=lists.postgresql.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=nmwIT4rP+TnqUtAvRGeICEHOik77oF5XqOJ+ixkAkf4=; b=Xnw6nCvLF1cVvA5m5JoIIK6N14D1L7gddcvLjQevtunl0tlD419iwcgalS73xvkj4r qBeC4VsF8QlVdFj7nnlDrq2cm7NK4CNfROuAPIk7ODc5zFVHScgiOh5Q4qSXzYiEyRWI Va64j2jqOWrztZe4Cw0af4wKjZ64nQ10mA9PVCtkq9uiiWTnPS9hPGlne4L/CPW7Q2Xg ko9PlksLzVltx+yBC5uVke4Ks25tnXunKoWul1ddOgI64NnD2BXq0rIP6SBBLl76/EE/ 3tEVf1CpkcgnoVe2xDvp/QBLgBhQ0gHuE0QU00eqF1WJPbU1NJBIeFIHJuTDc/qAwo8G OFPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764166594; x=1764771394; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=nmwIT4rP+TnqUtAvRGeICEHOik77oF5XqOJ+ixkAkf4=; b=i6wWTRMAt9mU1509mg36WTLyrSV2w3/gqVnGfFmIZibcU+0COT7WuI1AGPdXk+FC44 YbK6A+6csJdo1nsPsWjSSKyI84d9eHDGsR88DHF2QS3w4kerS8KgLCzaBJzmjThzie6v q6S0R99J4WpjxRer3ycCwD20H9DEszUnIc/JsCM3h6kHhYoeeJenY36rx71RVTRaD3hd JEVylk0AtliWccGOD0EFYl/CYG0aL56PUiG9YZXh0E9lEkA2NpWhrjvzltS6buHcJha7 f11Fe9jAloI8sMsQ3xtDJbxX8E2DwC4cZWkCwA0ElsQf0IgRzCxTS70gz1o5wA4xBi9G CYUg== X-Gm-Message-State: AOJu0Ywkyi3kAOmPLMaHMBuCi4B0MDhbKbz8/09EH+i8EobohjYUavxY Py2BhM0wSQvFCuiq9Cie9M8WjBbC3lVlPuoY5tFItsqryWaPCYsB2cf0UoANpz8dAvO52ihQNF+ +fYIdeTpVO5YbLMfe84HA90MHoRhtciEI2w== X-Gm-Gg: ASbGncsyKbPKfMD6qmxfO0MRsDC19vja/7BxHOP22u43U6dfWfJAib1UP+qIecqOZbv PfB6Sscc4WVICFzofP6mZUppfeJWr1fGo7BTRdq6ZD1J6M6H+ukkAOtC5voyNav4nJXHzn9SgiV accktpcay+nVgXhlm1UrkaXfgF4Fer3dAA2ZHGpr8WEt2qh1yRosEpgk2TuFoDyl7pXzcuyWR7y 3GmwILdRne+fqqtIVjWiFNDQ1uNBHYNOx3Z8UjgyPGfqasVU4UEEy77qp2Usis6YOJNs+Od X-Google-Smtp-Source: AGHT+IFncyjbUlpp+4ZX6Q051I4jSRzSquwBj+0rzxI5uGmTmAmvhF1tV0HrmxsIFBb8bEO/09ZT+9exfeJzqFdwiNQ= X-Received: by 2002:a05:6808:1786:b0:44f:773c:33cc with SMTP id 5614622812f47-45112b416a3mr8247910b6e.35.1764166594357; Wed, 26 Nov 2025 06:16:34 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Ron Johnson Date: Wed, 26 Nov 2025 09:16:23 -0500 X-Gm-Features: AWmQ_bkN3_02RrTnd4cpbmuPLChLqFqkkkn2Brg9xq9M8eY1nS_nVlPIuUAdT34 Message-ID: Subject: =?UTF-8?Q?Re=3A_Question_on_PostgreSQL_Table_Partitioning_=E2=80=93_Pe?= =?UTF-8?Q?rformance_of_Queries_That_Do_Not_Use_the_Partition_Key?= To: "pgsql-generallists.postgresql.org" Content-Type: multipart/alternative; boundary="0000000000002e6fcd0644800bb0" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000002e6fcd0644800bb0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Nov 26, 2025 at 8:32=E2=80=AFAM atma ram wrot= e: > Hi, > > Question on PostgreSQL Table Partitioning =E2=80=93 Performance of Querie= s That Do > Not Use the Partition Key > > We have a table that is approximately 1.6 GB in size. Query performance > has started to degrade. Although we have multiple indexes, the large tabl= e > size > 1.6GB is pretty darned tiny. Did you mean TB? When was the last time the table was vacuumed and analyzed? Tuning autovacuum parameters is important, but you might have to also create a cron job to regularly manually analyze and vacuum them. is still causing performance issues. > > We are planning to partition the table on the primary key. This is an OLT= P > system, and there are around 100 queries that access this table. About 80 > of these queries use the primary key and will therefore benefit directly > from the partition key once we implement partitioning. However, the > remaining 20 queries do not use the primary key; they rely on other index= ed > columns. > > Our question is: after partitioning the table, and after creating the > necessary indexes on each partition, what happens to the performance of > those 20 queries that do *not* use the partition key? > =E2=80=93 Will their performance degrade? > =E2=80=93 Will it remain the same as before partitioning? > =E2=80=93 Is there any chance it will improve? > > Additional details: we plan to create only 16 partitions, so the partitio= n > count will not be very high. > > *Is there any benchmarking, documentation, or reference material that can > help demonstrate how partitioning will affect the performance of the 20 > queries that do not use the partition key?* > > This information is critical for us before proceeding with the > partitioning strategy. > Every circumstance is different. You're going to have to test it. --=20 Death to , and butter sauce. Don't boil me, I'm still alive. lobster! --0000000000002e6fcd0644800bb0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Wed, Nov 26, 2025 at 8:32=E2=80=AFAM a= tma ram <atmaramkp@gmail.com&= gt; wrote:
Hi,

=
Question on PostgreSQL Table Partitioning =E2=80=93 Performance o= f Queries That Do Not Use the Partition Key=C2=A0=C2=A0

We have a table that is approximately 1.6 GB in size. Query perfor= mance has started to degrade. Although we have multiple indexes, the large = table size

1.6GB is pretty darned ti= ny.=C2=A0 Did you mean TB?

When was the last time = the table was vacuumed and analyzed?=C2=A0 Tuning autovacuum parameters is = important, but you might have to also create a cron job to regularly manual= ly analyze and vacuum them.

is still causing perfo= rmance issues.

We are planning to partition the table on the primary key. This is an OL= TP system, and there are around 100 queries that access this table. About 8= 0 of these queries use the primary key and will therefore benefit directly = from the partition key once we implement partitioning. However, the remaini= ng 20 queries do not use the primary key; they rely on other indexed column= s.

Our question is: after partitioning the table, and after creating the ne= cessary indexes on each partition, what happens to the performance of those= 20 queries that do not use the partition key?
=E2=80=93 Will their performance degrade?
=E2=80=93 Will it remain the same as before partitioning?
=E2=80=93 Is there any chance it will improve?

Additional details: we plan to create only 16 partitions, so the partiti= on count will not be very high.

Is there any benchmarking, do= cumentation, or reference material that can help demonstrate how partitioni= ng will affect the performance of the 20 queries that do not use the partit= ion key?

This information is critical for us before proceeding with the partition= ing strategy.

Every circumstan= ce is different. You're going to have to test it.

<= span class=3D"gmail_signature_prefix">--
Death to <Redacted>, and butter= sauce.
Don't boil me, I'm still alive.
<Redact= ed> lobster!
--0000000000002e6fcd0644800bb0--