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 1vJOWd-004Zpo-35 for pgsql-hackers@arkaria.postgresql.org; Thu, 13 Nov 2025 04:01:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vJOWb-00G8ds-2E for pgsql-hackers@arkaria.postgresql.org; Thu, 13 Nov 2025 04:01:33 +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 1vJOWb-00G8dk-1J for pgsql-hackers@lists.postgresql.org; Thu, 13 Nov 2025 04:01:33 +0000 Received: from mail-qt1-x841.google.com ([2607:f8b0:4864:20::841]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vJOWZ-007Sus-10 for pgsql-hackers@lists.postgresql.org; Thu, 13 Nov 2025 04:01:33 +0000 Received: by mail-qt1-x841.google.com with SMTP id d75a77b69052e-4ed82e82f0fso3827811cf.1 for ; Wed, 12 Nov 2025 20:01:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763006489; x=1763611289; 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=BxCpuLpV630+czCWQpsTvXoBB1pfF9d0Q0UX7TutvmM=; b=jz3lfl68hLJ8X3D/BPbd0Ilk26BDYGdWxhu/3C8CrGsI0i/tc/gdg7FS0IbNRKhGlM GtG9DqWxJQ+jsMty/tl87BRxXAF8Rtyjq7x7UAvAonxYZkCoIK109EJxrSFtua+9wxEM n3Se1KTiTRqPOt2ISa69rs2T4xIGux5lAULmLmD1874wn/fB+RrVpO+XuLVoZoqGiWWH 4UqpqPHspud9mDgKNrJQY9xnGlQucqY6GJWFqkjnDjYEz4yJQKz55Q462FmA5RuoD2L0 6erKzDGXJrLSBfZ2FXR8sOqInhu88K10H++kU0SMgkxde0WAjpvDxWfFNSpF7v7CNuxl sDAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763006489; x=1763611289; h=content-transfer-encoding:cc: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=BxCpuLpV630+czCWQpsTvXoBB1pfF9d0Q0UX7TutvmM=; b=lW1NMIg19W+BCrikjo10OD0mLuGv0Dg8cc7AE8kdiPPT+TW1ZRPjjgEEW2z5YSRdmJ CH5eTLVr8Fj53PIyZwKP7qNW55liK7W24Pv8M9Jr8RaJrllikzMDgL8Pbqx9UGfbQ+R/ /ChV7HDBLApJo5jYqkDgysRG/V3VxO5NXeJIsDcoCxeJQG8D78kcJz58ns4tVOm1+LkR bz5txoeIEwQk+vJ4tWS7tmmlasvtSyahiMQ8nEAp21ptIexZ/bMV/l2JhRKtCOUlcRFo ONS9bt49xJvF/Zex+K0pNDIGJ5FyZ60g6FGE53DXRSsq3qYPNaUx7jOfqPvb516ysqDT Czew== X-Gm-Message-State: AOJu0YxnrJGvBPg0HfgouqflNgx4nrLjpzDMI5smmOTMOhbbE5OV7wvF Ug+tzM6iv+U3MZt9GV5Uv6ggWcMqe/+PmODze4JhNE21fD4uQ+GOkk0hLLYHYTw+BQN6JEAVVZF antlI6O9uDbcdupaz23xwfZZudCgn//8= X-Gm-Gg: ASbGncv8rpBLdnxjofCxvlWWRg/Ib4T6hQzhe5MDyDKaKBfBBFkbmYiuIVWnTJPE+ms nGveIUg+4JD3yLI7AE6ZFpY4Quaw2SGARC6ergDkPZHaZUdx9PYN0ihj6TwzVELMgJigbz0ku9j 3M65tUnAGzO1E2j92hrIVB3/D7A23V2weYHjH53zdrtk6WBeiUDFLtpwFDcg7RIycWidcFVUJCs DXYSplkv01wqodBf0A0DsRcKz73aLjsJD2NeM/ojcvexXthDFsIne21VDewO5irXZ5O/Q6LBidX fi7f1beEuVtcNLZcT2bXpUKukDxQSVs+Pc0rQt0XxOs2O1cESiSbynGKZLTkH+VOueMsArb/BId 4L2HM X-Google-Smtp-Source: AGHT+IHukjHTdI6tuyGZLTfj+YtQi53Ul/ET7T0WRBJKFR7hlaTUzFoGJmeKjspKL/7n9sYQaMLCix1gFq8Tp3zqmTA= X-Received: by 2002:ac8:5d12:0:b0:4e8:b8d4:a7a0 with SMTP id d75a77b69052e-4eddbde1dfbmr77782591cf.66.1763006489458; Wed, 12 Nov 2025 20:01:29 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: John Naylor Date: Thu, 13 Nov 2025 11:01:18 +0700 X-Gm-Features: AWmQ_blUmp3--BFlRSNAHjp0eQfeSR-FLrdu5NegWE6LIcPu4BNak90lKuHrQuo Message-ID: Subject: Re: tuple radix sort To: David Geier 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 Wed, Nov 12, 2025 at 9:28=E2=80=AFPM David Geier w= rote: > I've also been looking into radix sort the last days to accelerate GIN > index builds. Ordering and removing duplicates requires a fast sort in > generate_trgm(). If that's the case then I suggest first seeing if dfd8e6c73ee made things any worse. A simpler possible improvement is to use a similar normalization step for the chars, if needed, then do the sort and quinique with a specialization for unsigned chars. (We don't yet specialize qunique, but that can be remedied). If you're interested, please start a separate thread for that. > What would be great is if we could build a generic radix sort > implementation, similarly to sort_template.h that can be used in other > places. We would have to think a bit about the interface because instead > of a comparator we would require some radix extraction callback. That's moving the goalposts too far IMO. I want to get to a place where I feel comfortable with the decisions made, and that already requires a lot of testing. Also, I don't want to risk introducing abstractions that make future improvements to tuplesort more cumbersome. -- John Naylor Amazon Web Services