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 1vEJX2-009z1Y-Tr for pgsql-hackers@arkaria.postgresql.org; Thu, 30 Oct 2025 03:41:00 +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 1vEJX1-005aCP-U8 for pgsql-hackers@arkaria.postgresql.org; Thu, 30 Oct 2025 03:40:58 +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 1vEJX1-005aCH-LB for pgsql-hackers@lists.postgresql.org; Thu, 30 Oct 2025 03:40:58 +0000 Received: from mail-qv1-xf44.google.com ([2607:f8b0:4864:20::f44]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vEJWz-004Us8-0b for pgsql-hackers@lists.postgresql.org; Thu, 30 Oct 2025 03:40:57 +0000 Received: by mail-qv1-xf44.google.com with SMTP id 6a1803df08f44-8801e4da400so3114926d6.3 for ; Wed, 29 Oct 2025 20:40:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761795656; x=1762400456; 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=ILzy8RwTNh/Xb+2LhL6Y6gDenLBJAUPdG+eR5RKHf3o=; b=XEHjW2aH6/EqAzmr59Yrgx4Tu6Go4dJDC3NqIqNlnM+gRRV5E+l2vz0Rt2mWHoxbFW VraLshXf8mNRI8bA9OoJlSjwzEVhailge29HOQeoeP78r5uARniNIPTFpftN6v9zdrtH 5f3IvglIHa43KAleV6NvV3i0+b3k8y1Gw0HqLnqKNdtzk0+0JMYyFqE2ixZSRsNexWDn UwwEdr0gbmrofkJ27OzB82PVPQndoFlRuR3w8xDLv2ZTiMBbfr31SM0qjrjzhBj9vkZb xLNkefWfOKYARpykn1fOx0b/2m8WMOnJ4MH+yPT8ZG/XCOydYkWR0NE0cVE/TQfFVpEo h0Jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761795656; x=1762400456; 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=ILzy8RwTNh/Xb+2LhL6Y6gDenLBJAUPdG+eR5RKHf3o=; b=J6UFnPb8EUTssvlFZGx+t6fCrXcAUd3mpAxkAtnMPsxmz2Yb2gORDS4leqoOjSke5z MYIsErC594cqUKddyjtuvQKOpLDG3TYd5dUYzacOfUadH/5BIdnMEqBxB455opzpg99T F162DvUOHnj/GAV5SqYOne6u9XXjm3YFT0/EEDfSBK+UMd9OJk89M0Zp3ZsIYVj0Ho3c ctGXSUkjI5Lwm3jNXKl4zlNFq9+DxK3N3oJjZsgVnm163lweItgNfhf3DdTtE0XlZhea zWYXXjTmeoL0H9r3Pz5Ye/iYDVcdKmz2lGmp2YUxx3Djpvwu9n749tH721ZeYql4KKWS 7gjQ== X-Gm-Message-State: AOJu0YxrEA8k7PzPqlMNAiPkjKS+wymSXl9ykGBrE8VLMHZ4NXHT7t4C PymPdYUC4E6x27t6vYqZ6qF+HAkmC3GesbdMrWSjvXMjV9LB4paq4H5zq9FmOjNGCqwt0WBMAX4 WbnLD0ukE2cr3Rvkg0/G2jOcSxoHFwNg= X-Gm-Gg: ASbGncuvy8BosFbrHRbONIKPz1+b+wfNT1OHngmK0rzvdGM1HHqgziijvKtBR9oDAgb 2Mlwa/6NK0LfttBQNezIOu7hPoP1Ol/FW4lRqugvuH/SevLXnirvQgPZS7XK2sMIVjvX6dOsR/v mRA+m3owFsqimyvNElOlqAelGLqdFuYy++CrjgT36J7VnGO+Ho2zaw022evQfiqSn8sT/GwEk2q Ot1jXKKMBKXwPJ/Kn50+GxK1wF37XtkUIQBQIWcknDPS2rEiV9XMVZ197JPgOeXECxA5DjUa/9X UYPVxO1O15p7t2kqN4GX5ih+SAJkz+9GUi5RT9jCnRsD/j94JPnffteHtzbzEcSIQPKH7Az1VTO 6H89F X-Google-Smtp-Source: AGHT+IGVV0hkeJufic11MTYKKlL5W531uDlBY1LdQ2uHHnFlOV+xWUGwcN3LT+X11x9Qh4y9qL4m/e33EjcLGUsmM6Y= X-Received: by 2002:a05:622a:1390:b0:4cd:53ea:2346 with SMTP id d75a77b69052e-4ed15b594c6mr65926151cf.19.1761795656299; Wed, 29 Oct 2025 20:40:56 -0700 (PDT) MIME-Version: 1.0 References: <17F6CDF1-2D93-4C38-B0F2-D52B51F4D167@gmail.com> In-Reply-To: <17F6CDF1-2D93-4C38-B0F2-D52B51F4D167@gmail.com> From: John Naylor Date: Thu, 30 Oct 2025 10:40:44 +0700 X-Gm-Features: AWmQ_bmPqJ1suDYwx0zjXHinFhb46r1j9byNASUpm-YSg9kGxhOD1Z0EC0czV3w Message-ID: Subject: Re: tuple radix sort To: Chao Li Cc: PostgreSQL Hackers , Peter Geoghegan 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 On Thu, Oct 30, 2025 at 8:56=E2=80=AFAM Chao Li wr= ote: > I changed work_men to 1GB and reran the test. As the high cardinality dat= a are still there, so I first reran with data: > With radix_sort on and off, execution time are almost the same. Are you by chance running with asserts on? It's happened before, so I have to make sure. That makes a big difference here because I disabled diversion thresholds in assert builds so that regression tests (few cases with large inputs) cover the paths I want, in addition to my running a standalone stress test. Speaking of tests, I forgot to mention that regression tests will fail since in-place radix sort is an unstable sort, as qsort is as well, but in a different way -- this is expected. In assert builds, the patch verifies the sort after the fact with the standard comparator, and will throw an error if it's wrong. On Thu, Oct 30, 2025 at 9:19=E2=80=AFAM Chao Li wr= ote: > I just quick went through the code change. I guess I need more time to un= derstand the entire logic, but I find a typo that might effect the tests: > > ``` > + Assert(last =3D first); > ``` > > =E2=80=9C=3D=E2=80=9C should be =E2=80=9C=3D=3D" Yes, you're quite right, thanks for spotting! I reran my stress test that has randomly distributed NULLs and the assert still holds, so nothing further to fix yet. The NULL partitioning part of the code hasn't been well tested in its current form, and I may arrange things so that that step and the datum conditioning step happen in a single pass. I'm not yet sure if it's important enough to justify the additional complexity. -- John Naylor Amazon Web Services