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 1tL0cc-00C5oC-Sq for pgsql-bugs@arkaria.postgresql.org; Tue, 10 Dec 2024 13:49:54 +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 1tL0ca-004iU1-5w for pgsql-bugs@arkaria.postgresql.org; Tue, 10 Dec 2024 13:49:53 +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 1tL08h-004Jhq-76 for pgsql-bugs@lists.postgresql.org; Tue, 10 Dec 2024 13:19:00 +0000 Received: from ns101513.ip-147-135-7.us ([147.135.7.79] helo=smtp.gromco.com) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tL08f-0024ms-Oc for pgsql-bugs@lists.postgresql.org; Tue, 10 Dec 2024 13:18:59 +0000 Received: from [10.10.0.6] (unknown [10.10.0.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: mal) by smtp.gromco.com (Postfix) with ESMTPSA id 8C4F6340751 for ; Tue, 10 Dec 2024 08:18:55 -0500 (EST) Message-ID: Date: Tue, 10 Dec 2024 08:18:53 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: pgsql-bugs@lists.postgresql.org From: Vladislav Malyshkin Subject: postgres 16 index double variable seems to fail. postgres 15 OK Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I am not completely sure, but there seems to be a regression in postgres 16.
Let there be a table with millions of records

  CREATE TABLE table1(
    inode int::8 not null,
    fieldNum int not null,
    wordFromText text not null,
    wordIndex int
  );
with multi-field index
CREATE INDEX table1_indx_textsearch2_Words ON table (inode,fieldNum,wordIndex);

The problem now seems to be that the queries on a single variable inode such as
DELETE FROM table1 WHERE inode=133218
and others, especially when used in some JOIN, it seems does not use the index and run slow.
There were no such problem in postgres 15.
When I create one more index, now a single-field one.
CREATE INDEX table1_indx2 ON table (inode);
postgers 16 becomes fast again.
Postgres 15 was happy with thee fields index (inode,fieldNum,wordIndex), and did not need a single variable index.

Vladislav