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 1jlJi9-0006WJ-Ft for pgsql-performance@arkaria.postgresql.org; Tue, 16 Jun 2020 22:05:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jlJi6-0007MY-Is for pgsql-performance@arkaria.postgresql.org; Tue, 16 Jun 2020 22:05:38 +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 1jlJi6-0007MQ-8P for pgsql-performance@lists.postgresql.org; Tue, 16 Jun 2020 22:05:38 +0000 Received: from mail-il1-x133.google.com ([2607:f8b0:4864:20::133]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jlJhz-00037b-D7 for pgsql-performance@lists.postgresql.org; Tue, 16 Jun 2020 22:05:37 +0000 Received: by mail-il1-x133.google.com with SMTP id i1so78636ils.11 for ; Tue, 16 Jun 2020 15:05:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=kwrNMipZZ+04fpxt+arMcAn3Wmrk+qBGpar4ccDx7hw=; b=1KgWa/+a+npUcMQSccGWwkVgWxm0UELXT5n7iw9WshXRHcPAV8mgEQjcOgHrF7LKXu Nngpe95InR/wPKreLpRqrV27vl033abtHTzDuFwTQ1e8+w7E2qGhAwy/6dIKrWLGuKqV VQwBN+EDjpbDJy0madFR1RfhVerSEz3yAL8fycEUQvLnpSQpqKLnL/Qn+dhN8RS+Oans GsqpUYP3LHnA7voTUj4/sA2jSX9YxiA51hwCI0Ioi9g+xbz3yPv3vI2bVmrqPwg0b+OM s2qoX8T5pcN0r/E62CtkwRFsM04nI63K63JZTY5ikTwg8KD1s0q5YCqBV/payP4NlWUK Dfyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=kwrNMipZZ+04fpxt+arMcAn3Wmrk+qBGpar4ccDx7hw=; b=gCjRwhgAinVIn6wVJAeY60i+kgPTzzQ/6SehcGrEf/mo1j47pO/ofBAXgiSFDkR0IW lzs/1j4k2uN85qa0oNzRruxnEiBV/Zfoo90rImyal/C578SUO0l/3vH85jcvoxbgNT6B 9tvTVZzOd8y3UxrIoOChTSOGveLtnNJhm+LP2bReaptYN/4eg6J4+P4H9XB/ON/U6792 8VaJMPeInc4X9JFMwV7geJJYbL7zy9mOeNOtYIW/YO+gVpjzHD/gIQ5qq1Mt4hjFwEkh kvT27koXcVmc2/U8eD7sql0dUZr343iLsI24fkm8KMa5XbU6kvAZ8mP5aCcaniRX4Nlo G0jQ== X-Gm-Message-State: AOAM532PJptLRJuf3WskyERSLWFbiUlFH1EDuhqFhwOXu87jMbVgPyAJ TKpNfPxwVOvlO5owal73RrI8EHgprz3bvg== X-Google-Smtp-Source: ABdhPJw6+jDmCcGMwV93ztMVWue5ZcYEBJ67uD/EO7H8jLTc0th84MPZ/AJBoe9AaG20HJqFyZRSSw== X-Received: by 2002:a92:d3cd:: with SMTP id c13mr5438425ilh.101.1592345129105; Tue, 16 Jun 2020 15:05:29 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id o12sm10131335iob.6.2020.06.16.15.05.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Jun 2020 15:05:28 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id EB6E5800123; Tue, 16 Jun 2020 17:05:26 -0500 (CDT) Date: Tue, 16 Jun 2020 17:05:26 -0500 From: Justin Pryzby To: Nagaraj Raj Cc: pgsql-performance@lists.postgresql.org Subject: Re: simple query running for ever Message-ID: <20200616220526.GK20404@telsasoft.com> References: <574079062.1873527.1592339731136.ref@mail.yahoo.com> <574079062.1873527.1592339731136@mail.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <574079062.1873527.1592339731136@mail.yahoo.com> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Tue, Jun 16, 2020 at 08:35:31PM +0000, Nagaraj Raj wrote: > I wrote a simple query, and it is taking too long, not sure what is wrong in it, even its not giving EXPLAIN ANALYZE. > > select T0."physical_address_sid", T0."individual_entity_proxy_id", T2."infrrd_hh_rank_nbr" > from "cms_prospects".PROSPECT T0 > --inner join "sas_prs_tmp".DEDUPE3583E3F18 T1 on T0."individual_entity_proxy_id" = T1."individual_entity_proxy_id" > left join "cms_prospects".INDIVIDUAL_DEMOGRAPHIC T2 on T0."individual_entity_proxy_id" = T2."individual_entity_proxy_id" Pardon me for saying so, but this query seems silly. It's self-joining a table on its PK, which I don't think could ever be useful. You do maybe more than 2x as much work, to get 2x as many columns, which are all redundant. Can't you just change T2."infrrd_hh_rank_nbr" to T0, and avoid the join ? -- Justin