Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jv9yN-000319-AP for pgsql-admin@arkaria.postgresql.org; Tue, 14 Jul 2020 01:43:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jv9yM-0004qk-9O for pgsql-admin@arkaria.postgresql.org; Tue, 14 Jul 2020 01:43:06 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jv9yM-0004mI-1w for pgsql-admin@lists.postgresql.org; Tue, 14 Jul 2020 01:43:06 +0000 Received: from mailout.easymail.ca ([64.68.200.34]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jv9yJ-0000c3-Lf for pgsql-admin@postgresql.org; Tue, 14 Jul 2020 01:43:05 +0000 Received: from localhost (localhost [127.0.0.1]) by mailout.easymail.ca (Postfix) with ESMTP id 2155F20A9A; Tue, 14 Jul 2020 01:43:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at emo06-pco.easydns.vpn Received: from mailout.easymail.ca ([127.0.0.1]) by localhost (emo06-pco.easydns.vpn [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Z1D37nOk4WcT; Tue, 14 Jul 2020 01:43:02 +0000 (UTC) Received: from shr-macbook-pro.local (unknown [4.28.96.150]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mailout.easymail.ca (Postfix) with ESMTPSA id 79A05209C5; Tue, 14 Jul 2020 01:43:00 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: Joining between large & small tables? From: Scott Ribe In-Reply-To: Date: Mon, 13 Jul 2020 19:42:59 -0600 Cc: pgsql-admin Content-Transfer-Encoding: quoted-printable Message-Id: <258F84EA-9EF3-43C0-B3FC-82E9154EDE54@elevated-dev.com> References: To: Wells Oliver X-Mailer: Apple Mail (2.3608.80.23.2.2) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > On Jul 13, 2020, at 7:39 PM, Wells Oliver = wrote: >=20 > Given a large large large table A and a small small temp table B is = there any benefit to doing SELECT * FROM a JOIN b USING (somecol) vs = SELECT * FROM b JOIN a USING (somecol)? >=20 > When you just want the intersection... No, planner will figure out how to join based on stats, not order. (With = default planner options; there are ways to work around that in the rare = case that the planner can't figure out the best way.)=