Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d3LEq-0007S6-D1 for pgsql-performance@arkaria.postgresql.org; Wed, 26 Apr 2017 11:36:04 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1d3LEp-0001iK-Vb for pgsql-performance@arkaria.postgresql.org; Wed, 26 Apr 2017 11:36:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1d3LEp-0001gA-4p for pgsql-performance@postgresql.org; Wed, 26 Apr 2017 11:36:03 +0000 Received: from smtp-4.sys.kth.se ([2001:6b0:1:1300:250:56ff:fea6:2de3]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1d3LEl-0007Lu-Nv for pgsql-performance@postgresql.org; Wed, 26 Apr 2017 11:36:02 +0000 Received: from smtp-4.sys.kth.se (localhost.localdomain [127.0.0.1]) by smtp-4.sys.kth.se (Postfix) with ESMTP id D2057212 for ; Wed, 26 Apr 2017 13:35:58 +0200 (CEST) X-Virus-Scanned: by amavisd-new at kth.se Received: from smtp-4.sys.kth.se ([127.0.0.1]) by smtp-4.sys.kth.se (smtp-4.sys.kth.se [127.0.0.1]) (amavisd-new, port 10024) with LMTP id qLAdmS7uTj1I for ; Wed, 26 Apr 2017 13:35:58 +0200 (CEST) X-KTH-Auth: eskil [2001:6b0:1:11f0:6e62:6dff:fe6a:ffa3] DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kth.se; s=default; t=1493206558; bh=Iv3GnDCHJxir9MwiyZCzbYGv9TbaYRAbuafNrbNkS6I=; h=Subject:From:To:Date:In-Reply-To:References; b=G2y/lh46zXV4200l5hgZMQttnREqsvvJRlF86qiECMQBmquTHvyFv+WwA3yu04UdF Sg6FLi+YoZ7qRXAn6aXjnzdU7I37DD70SiSWf1Tc9n9Rn0j1UQypmvUxoh1qijHbTe I0KF6HmsJNStkh6VIS2cAL5b4m+gCZLRUpNOj208= X-KTH-mail-from: eskil@kth.se X-KTH-rcpt-to: pgsql-performance@postgresql.org Received: from tiny.ite.kth.se (tiny.ite.kth.se [IPv6:2001:6b0:1:11f0:6e62:6dff:fe6a:ffa3]) by smtp-4.sys.kth.se (Postfix) with ESMTPSA id 48106189 for ; Wed, 26 Apr 2017 13:35:57 +0200 (CEST) Message-ID: <1493206557.30225.5.camel@kth.se> Subject: Re: Slow query with 3 table joins From: Johan Fredriksson To: pgsql-performance@postgresql.org Date: Wed, 26 Apr 2017 13:35:57 +0200 In-Reply-To: References: <1493187867.30225.3.camel@kth.se> Organization: KTH Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.11 (3.12.11-22.el7) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -4.3 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org > Hi Eskil - > > > The I believe the id-field you're referring to is the UNIT.UNIT_ID, I > could change this to a varchar, however that column is not used in the > query in question, so that wouldn't have any effect on the query's > performance. Sorry, I did not notice that the column "unit_id" existed in both "unit" and "field" tables. / Eskil -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance