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 1tDSGq-000q7l-Cq for pgsql-general@arkaria.postgresql.org; Tue, 19 Nov 2024 17:44:12 +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 1tDSGp-00FUej-2h for pgsql-general@arkaria.postgresql.org; Tue, 19 Nov 2024 17:44:11 +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 1tDSGo-00FUdl-MI for pgsql-general@lists.postgresql.org; Tue, 19 Nov 2024 17:44:10 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tDSGj-002jen-9B for pgsql-general@lists.postgresql.org; Tue, 19 Nov 2024 17:44:09 +0000 Received: by mail-wr1-x442.google.com with SMTP id ffacd0b85a97d-3823eaad37aso21574f8f.0 for ; Tue, 19 Nov 2024 09:44:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=cybertec.at; t=1732038244; x=1732643044; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=Zt2BPgLidbJOjis7Ne0KtQF0IveoN7o39gWWglCKlao=; b=OTuqriv75PR9NUps7oPdLXnSI9+zBVO0TWueOkOXYo4xTcyxgPJECAssK0RrwrOx0f S3L5gUnf1WNEwosYSWY3fkAcJxZZCfO9i8QOVIv2Ihjxj0WiTYrUBM3ElOTAipD3zqIW lz/SlpO5A/rRGgm1WYKlW4yAi7PVBjtKh1Rao= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732038244; x=1732643044; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Zt2BPgLidbJOjis7Ne0KtQF0IveoN7o39gWWglCKlao=; b=j29k2EAnq4bR165t5p48YeqsOuFLSVJLVOXexvMiVbv3tCz9/RAjhXmelNkbt/JfzY mMIxiHcGl+9ClhQfoDrjxnvGIMWBXLz0XVd6nrk4FleNCZfBOv3iKSjzybzrjAa2cGoC OVIXKMIpWZyilCn4z7cH7UASEFAM7efmP3+awmOt6enfL6nJdRKuvyQ9LmWk2MLnfJoG sZNOP3u+qXXUSBUqeIegyMPGbWZ2SJGkcNjlURcptK2vRagWs2nDElRbV0bI4XvOER5g 4DO3CBXH1F7w4sZ3cEc8m06xf+xcm+GUpa2dP+9qn8KqpzZYt+acfRfUVyNETp1H3J0a nClQ== X-Forwarded-Encrypted: i=1; AJvYcCUKRocMsvM4ITLpZ8N4HQyw+S5Sz8oyNBa5x02H3BdCeFVNBbbROTC0GmdOLyV+tVoIoY/QkxoYOxVn6tW3@lists.postgresql.org X-Gm-Message-State: AOJu0YyX6OReXikiRApcMCPtiu+nLJfwmG+j4e+gVuYM+DKY1zOduEqi wB0VnwA7I1Vc0DcjreaWtWsR/XXbuI0LYl9zVx1Ryp3OuXZpPt2yQaSkN/1gi7j5yTsSvApTTQj pUunpyg== X-Google-Smtp-Source: AGHT+IH+8JIx5dn+HlF+dz2u6SmiI5Q6h8X9MSLGGx9uJUXOcMPggtLuTc1lELcKBAr0WAVktjkxqQ== X-Received: by 2002:a05:6000:1545:b0:382:3ef9:dfca with SMTP id ffacd0b85a97d-3824cd5fc96mr3924450f8f.25.1732038243645; Tue, 19 Nov 2024 09:44:03 -0800 (PST) Received: from localhost.localdomain ([91.26.40.154]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432dab721efsm204474345e9.4.2024.11.19.09.44.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Nov 2024 09:44:03 -0800 (PST) Message-ID: <40c19c0217025001681c78a7b65f30bc02ea57fc.camel@cybertec.at> Subject: Re: Functions and Indexes From: Laurenz Albe To: Moreno Andreo , pgsql-general@lists.postgresql.org Date: Tue, 19 Nov 2024 18:44:03 +0100 In-Reply-To: <92aa9401-e44d-4a45-9851-0617935e06a2@evolu-s.it> References: <2e36a2fe-b30f-46a5-937f-3b7d94e75cb6@evolu-s.it> <8dfd0bd5-87e5-4de7-9f60-8a680a32bc11@evolu-s.it> <61cb94a962667788c9c09107fa9937300e54d3cd.camel@cybertec.at> <14fa809c-a2b7-4d36-9382-d08a5df4718a@evolu-s.it> <92aa9401-e44d-4a45-9851-0617935e06a2@evolu-s.it> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.52.4 (3.52.4-2.fc40) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, 2024-11-19 at 14:30 +0100, Moreno Andreo wrote: > Inhttps://www.cybertec-postgresql.com/en/join-strategies-and-performance-= in-postgresql/ > =C2=A0you say=20 > =C2=A0"Note that for inner joins there is no distinction between the join= condition and the=C2=A0WHERE=C2=A0condition, but that doesn't hold for out= er joins." > =C2=A0What do you mean? CREATE TABLE a (id integer); INSERT INTO a VALUES (1), (2), (3); CREATE TABLE b (id integer); INSERT INTO b VALUES (1), (2), (4); SELECT * FROM a JOIN b ON a.id =3D b.id AND b.id < 2; id =E2=94=82 id=20 =E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=AA=E2=95=90=E2=95=90=E2=95=90=E2= =95=90 1 =E2=94=82 1 (1 row) SELECT * FROM a JOIN b ON a.id =3D b.id WHERE b.id < 2; id =E2=94=82 id=20 =E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=AA=E2=95=90=E2=95=90=E2=95=90=E2= =95=90 1 =E2=94=82 1 (1 row) SELECT * FROM a LEFT JOIN b ON a.id =3D b.id AND b.id < 2; id =E2=94=82 id=20 =E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=AA=E2=95=90=E2=95=90=E2=95=90=E2= =95=90 1 =E2=94=82 1 2 =E2=94=82 =E2=88=85 3 =E2=94=82 =E2=88=85 (3 rows) SELECT * FROM a LEFT JOIN b ON a.id =3D b.id WHERE b.id < 2; id =E2=94=82 id=20 =E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=AA=E2=95=90=E2=95=90=E2=95=90=E2= =95=90 1 =E2=94=82 1 (1 row) Yours, Laurenz Albe