Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dl8io-0004Hh-JE for pgsql-performance@arkaria.postgresql.org; Fri, 25 Aug 2017 07:08:02 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dl8in-0001db-K6 for pgsql-performance@arkaria.postgresql.org; Fri, 25 Aug 2017 07:08:01 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dl8h2-0006yf-He for pgsql-performance@postgresql.org; Fri, 25 Aug 2017 07:06:12 +0000 Received: from lb3-smtp-cloud8.xs4all.net ([194.109.24.29]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dl8gu-0002OS-VA for pgsql-performance@postgresql.org; Fri, 25 Aug 2017 07:06:11 +0000 Received: from webmail.xs4all.nl ([IPv6:2001:888:0:22:194:109:20:213]) by smtp-cloud8.xs4all.net with ESMTPA id l8gqd6YKOcQyLl8gqdoM7J; Fri, 25 Aug 2017 09:06:01 +0200 Received: from mail.genj.nl ([77.242.116.162]) by webmail.xs4all.nl with HTTP (HTTP/1.1 POST); Fri, 25 Aug 2017 09:06:00 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 25 Aug 2017 09:06:00 +0200 From: vinny To: Mariel Cherkassky Cc: pgsql-performance@postgresql.org Subject: Re: query runs for more than 24 hours! In-Reply-To: References: Message-ID: <754d24d26f8a4da4e3a3d43157d7a036@xs4all.nl> X-Sender: vinny@xs4all.nl User-Agent: XS4ALL Webmail X-CMAE-Envelope: MS4wfCRzxaCJPrODAqM/vBtN81DzsLPlMfLQLzFy+ZQF3Lbpoviajpz2qDb4aDo4jLG2YgwYgLD5iSZaUrHYhqFg7xILylADOMR7rV+6tybcbRNldgRUKtCJ khq+5+JNT9PdKuhuDd2aWxSGOtHhUn8DAob+1+CSPdpYf2QHiUQT34Fwd4MIA4WLTkyrCoZQVh0gFq6Ew2AYoXYwLHUm2t62EjiXBoy6qQU/kZmyo7/pTgej PrCOOhH+MB1iK7+ByaN2PEN+lC1hEfN6SPLDXDltUR8= 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 On 2017-08-22 16:23, Mariel Cherkassky wrote: > > SELECT a.inst_prod_id, > product_id, > nap_area2, > nap_phone_num, > nap_product_id, > b.nap_discount_num, > b.nap_makat_cd, > nap_act_start_dt, > b.nap_debt_line, > nap_act_end_dt, > b.row_added_dttm > b.row_lastmant_dttm, > FROM ps_rf_inst_prod a, > AND a.setid || ''= 'SHARE' > nap_ip_discount b > WHERE nap_crm_status = 'C_04' > AND b.nap_makat_cd IN (SELECT > term_code AND b.setid || ''= > 'SHARE' > AND a.inst_prod_id = On my screen the order of the lines in the query seem to get messed up, I'm not sure if that's my email program or a copy/paste error. From what I can see, you are using subselects in an IN statement, which can be a problem if that has to be re-evaluated a lot. It's hard for me to say more because I can't tell what the actual query is at the moment. Regards, Vincent. -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance