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 1sMrI4-00560d-BC for pgsql-general@arkaria.postgresql.org; Thu, 27 Jun 2024 15:44:04 +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 1sMrI2-00BJOh-AH for pgsql-general@arkaria.postgresql.org; Thu, 27 Jun 2024 15:44:02 +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 1sMrI1-00BJOY-VS for pgsql-general@lists.postgresql.org; Thu, 27 Jun 2024 15:44:02 +0000 Received: from mail-oa1-x2b.google.com ([2001:4860:4864:20::2b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sMrHz-003PHr-Pk for pgsql-general@postgresql.org; Thu, 27 Jun 2024 15:44:01 +0000 Received: by mail-oa1-x2b.google.com with SMTP id 586e51a60fabf-25c9ef2701fso4437017fac.1 for ; Thu, 27 Jun 2024 08:43:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719503039; x=1720107839; darn=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=hFo7QiZfDClmOOd/a41NRafnC3xGbG7wyp37Ktm0yJw=; b=VvBmP2+3bY3l4kv7MqNLJZLy6Hi5neHa+lz78dzvV0xXXZy8H8noAIlCS9hn5xC9Lg JHep5hR0hfEBc6FLVRYUL+xmXdIoLmqf5p+uhtVBQb9Wh7MTWdQmOuANF6w1aM9kiM6e W0owMuo/FY9tkauKmHvq+VyX29Kzg6WmNs/HGiMlAD6ovLRrrjCVYV4FiS/WXh/LaR4P iBN0+B0NsLgbKMrwfBaQOSjayMiDGsb9sWSwn7gH0PJymTg57x9qSfH9JX/x2GwfyTNP 4kTSRKEoVLZ/Z0eAoxq4nI5hqWgYZ+IfHZSFCH+hySwQhZ1JPyDj7Jqt79PSAoYiI7UD V9Rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719503039; x=1720107839; h=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=hFo7QiZfDClmOOd/a41NRafnC3xGbG7wyp37Ktm0yJw=; b=ZSxCPa3Znh369ro4nqFng2I26A5j/zbnYuJoWgSY+awRoi/JqJL1bCVJQobfzESuHp ZyJxts3rmytnVSHJ2NQzSzUHC1ymZsKOIAurpSd8b86OCgstGa8l1gLd/2SjYHKjbI6e q8/BpJUIdAylAnpvFdvayfgtfAD4dcNAnVT9evfkpBf7rVYdtI2QbYTKTdE9VnJUzvwa JhuR4vwwSu/wyR+Q8VLJttj2aKS0PBH4T6JU1sr4/0yLFqU1IrsF1ZEZf1um5KBdWEVY 83xGqSyN0pnzs6p30aRdjlnpAA6UbFoNPNLq58RNUI0yyvUjsm5MisP4eGvtlGlXW3Rj +ewg== X-Gm-Message-State: AOJu0Yz/Ucg/k3IbCyH2sCGjZWzi5Dle5CgbNw4SPdtERilK3LGvR8Nh xXpN1JsL8mQHdAkP94AF763UCI8QBbUbXK4r4OUVaq7BdvPm+juIjrbm6Ga2MpbWMv/FolnzzbE 4VgZ4yYBIJt7pMFOhxsitvd0vPbfflluO X-Google-Smtp-Source: AGHT+IGcJM26b4IUpJrtNYCOi1pTyCOkteSV6s2oZfz8VMK92N9moxR9+XELsMy4bk+XfJeZ6Gn25et6F5pqkIqdE2w= X-Received: by 2002:a05:6870:ec92:b0:25a:eca3:6b5b with SMTP id 586e51a60fabf-25d06bb4276mr13847271fac.3.1719503038968; Thu, 27 Jun 2024 08:43:58 -0700 (PDT) MIME-Version: 1.0 References: <451083be-83e8-413d-bc3a-ed7f3a6d99a9@gmail.com> In-Reply-To: From: Ron Johnson Date: Thu, 27 Jun 2024 11:43:47 -0400 Message-ID: Subject: Re: A way to optimize sql about the last temporary-related row To: pgsql-general Content-Type: multipart/alternative; boundary="000000000000d3fc5b061be0ffdf" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000d3fc5b061be0ffdf Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Jun 27, 2024 at 11:33=E2=80=AFAM agharta82@gmail.com wrote: > Hi, > > You are right. Too quickly copy-paste on my part :-) > > I take this opportunity to add a NOT insignificant detail. > > Before executing the select query I clear the cache: > > systemctl stop postgresql-16 && sync && echo 3 > /proc/sys/vm/drop_caches > && systemctl start postgresql-16 > > I need to get a performance result even if data is not in cache. > In addition to David's suggestion, consider the pg_prewarm extension: https://www.postgresql.org/docs/current/pgprewarm.html --000000000000d3fc5b061be0ffdf Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Thu, Jun 27, 2024 at 11:33=E2=80=AFAM = agharta82@gmail.com <agharta82@gmail.com> wrote:
=20 =20 =20

Hi,

You are right. Too quickly copy-paste on my part :-)

I take this opportunity to add a NOT insignificant detail.

Before executing the select query I clear the cache:

systemctl stop postgresql-16 && sync && echo 3 > /proc/sys/vm/drop_caches=C2=A0 &&=C2=A0 systemctl start postgresql-16

I need to get a performance result even if data is not in cache.

=

In addition to David's suggestio= n, consider the pg_prewarm extension:=C2=A0https://www.postgresql.org/docs/current/= pgprewarm.html
=C2=A0
--000000000000d3fc5b061be0ffdf--