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 1rsF8o-005kv2-RZ for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Apr 2024 04:55:59 +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 1rsF7p-00EpOH-DZ for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Apr 2024 04:54:57 +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 1rsF7o-00EpO7-Rd for pgsql-hackers@lists.postgresql.org; Thu, 04 Apr 2024 04:54:57 +0000 Received: from mail-oa1-x30.google.com ([2001:4860:4864:20::30]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rsF7k-000XXo-F0 for pgsql-hackers@lists.postgresql.org; Thu, 04 Apr 2024 04:54:55 +0000 Received: by mail-oa1-x30.google.com with SMTP id 586e51a60fabf-22a5df0f789so269173fac.3 for ; Wed, 03 Apr 2024 21:54:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20230601.gappssmtp.com; s=20230601; t=1712206490; x=1712811290; 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=nzaKooIcEwrkma2jB363oz09JYoWGHMh6qpbKDu4R/8=; b=WF0i6vekqJITotkB1trVA+ltuI6TKzqmGexRZxIJagVW+nPTfEg9D2zTuJcgJc6X1W v/HtzxD0YT0W0Aw+mh/BeWATSyKprOk6uofkFl8QijPtDbExtds0bZZLR6GzhDJoBnpl m0IO5uD0CUvsAss9Lnaoe0UcQo7WjRKrM8DvyGhz9geyt4YbB5zLGBMSdWBOVco+Ev8W wpYAkaaEna7cRtf31z+erjtv6spca8BQYCPMw83s2pAUhsscHbSZDOFXciBxiG1XqseR 5GS3sKuXhsO55DV6cyMYKwf49RSyHk4vC4Jr16OskmnUXUf323dofmneeUL+Xlx1mm6M 9ebw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712206490; x=1712811290; 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=nzaKooIcEwrkma2jB363oz09JYoWGHMh6qpbKDu4R/8=; b=vJ7PZTtH0LZ7jvJ0kU1E+VYRWZnJpa/AyNGXEHyFh20EAkv1FjSZ4kXUr8K8pJfkn3 TDPPdsKLhFlr8nhNVrQlC91iNQCXlGrDrN+x/H2tkPWPl4fxsW89ICVqH+1+/7OfXlkI BJLPa5lN/1iX0+MPJP8mQZr1pYtF7WIaVyqk9TuJUq5jW0HAyrGB93l01Nw+AZv9m06n cifXOvIvER+z3qUXcc0T/oDyx0dd+lVR+BwDBERpZ9q5x+N97wE7sUcZN9D5rZytEGDC 7bDmOSDcc5zHWPYwMIF+33NKx2uDrTmaRgxS/9ROCqxTT6KE2Mghpqa+5/rJ0OWK1e/j QVtA== X-Forwarded-Encrypted: i=1; AJvYcCXyXmemdpaNkSUiJ4wTB86mb0ZgbobBdsafLH/uv4i8r9xetnJ0mcZnACGJDmkqmW8WqKKtdL3tgZQq1fngbMkJoSVy2yvlmuWsZOf+qONgVDdK X-Gm-Message-State: AOJu0YwUa+vpiPn+NMqxO49ZBk734i254DSAeoOJny4wwKEHtxEFwo9w o2wM0lyek3PKePQZI797An+CJv2VZf6852PQXXwKHs6Vmi1XaguJMJ42x6AFhA== X-Google-Smtp-Source: AGHT+IHTk3gTLrq1g1LpLm0Gs/rZNhWODTX3jnMydRhv/CpZ5RJNtpNwXwK0+llxnJzAIY6NHHVCFw== X-Received: by 2002:a05:6871:3a21:b0:22a:4c05:2efd with SMTP id pu33-20020a0568713a2100b0022a4c052efdmr1504612oac.10.1712206490326; Wed, 03 Apr 2024 21:54:50 -0700 (PDT) Received: from jeff-laptop.lan (c-76-102-242-158.hsd1.ca.comcast.net. [76.102.242.158]) by smtp.gmail.com with ESMTPSA id x28-20020a056a000bdc00b006ecf1922df7sm161014pfu.36.2024.04.03.21.54.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 21:54:49 -0700 (PDT) Message-ID: Subject: Re: Improve eviction algorithm in ReorderBuffer From: Jeff Davis To: Masahiko Sawada Cc: Amit Kapila , vignesh C , Peter Smith , Tomas Vondra , "Hayato Kuroda (Fujitsu)" , Shubham Khanna , Dilip Kumar , PostgreSQL Hackers Date: Wed, 03 Apr 2024 21:54:48 -0700 In-Reply-To: References: <23e03725-8c77-431d-9f53-51709260ffeb@enterprisedb.com> <787cd90b-48ff-4c4a-a63e-a2b3f494385d@enterprisedb.com> <12747c15811d94efcc5cda72d6b35c80d7bf3443.camel@j-davis.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4-0ubuntu2 MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 2024-04-04 at 09:31 +0900, Masahiko Sawada wrote: > IIUC, with your suggestion, sift_{up|down} needs to update the > heap_index field as well. Does it mean that the caller needs to pass > the address of heap_index down to sift_{up|down}? I'm not sure quite how binaryheap should be changed. Bringing the heap implementation into reorderbuffer.c would obviously work, but that would be more code. Another option might be to make the API of binaryheap look a little more like simplehash, where some #defines control optional behavior and can tell the implementation where to find fields in the structure. Perhaps it's not worth the effort though, if performance is already good enough? Regards, Jeff Davis