Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gQuUE-000316-1h for pgsql-performance@arkaria.postgresql.org; Sun, 25 Nov 2018 13:30:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gQuUC-0007yS-Eg for pgsql-performance@arkaria.postgresql.org; Sun, 25 Nov 2018 13:30:08 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gQuUB-0007yL-UR for pgsql-performance@lists.postgresql.org; Sun, 25 Nov 2018 13:30:08 +0000 Received: from mail-io1-xd32.google.com ([2607:f8b0:4864:20::d32]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gQuU8-0007BT-KT for pgsql-performance@lists.postgresql.org; Sun, 25 Nov 2018 13:30:06 +0000 Received: by mail-io1-xd32.google.com with SMTP id f6so11874171iob.1 for ; Sun, 25 Nov 2018 05:30:04 -0800 (PST) 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=ubypFWevg0O0HyUbsMJkW3MG63iDOEuVXI/zd2N3Am4=; b=Nt7o4q2L4h+btrm/J4Of5A7SyBPcwCHOejSvnAEgcSuRfIHkw64Ijth1xLn/aiO5a2 jgbs0vp32Jh7p/bbvLm49ETbIKdZc8r77fe8YfrSGghy2oVjGkvmhatupkHnDhiKSenD pxQmKzqmPEny2Uekdl8Xn++5a94LrGF62ruvLw9cjXn91IWrs1b7xj6udoOf5aBXEdIp 3Hes5jOZ9D1WZgty8A4zNRBBHgKndp6umiDCsymCxOTNl1+8ao2JJnSt+kJcTdy7mvBg VB2H/Re5t6X1AAo4rbnzDKUx6hSZk7fueTJP2B+PPv/rvAFHC1Ca1ctP2906mSASgnmj /pew== 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=ubypFWevg0O0HyUbsMJkW3MG63iDOEuVXI/zd2N3Am4=; b=MwEOMG1UrJ37JdDHQQNBhKl7Sovk7TWChbxZcBX1R33ojQB1SbpYauktw1mnC42EDn Rdwegda5dIYfL2zHWZSpd060cKM1KUDt7krD2fNCPjrixkLezseY0kLmQpbQvR0Z/OF8 kT8h5XIKeC6JLqmGOrgrGMOiS+Lpp/SI+AiLt6Hi14R6glq43WdA70ghluKpx0WTnMFU s7gHRYVsz+aJmVcUbEU7U2YbJkzDocDmx7Odq29mewPnXJs0voiXaKPRzUfyRqPmBpck /PZQVvusunTxkGTtvPXG+OR7j+FQGMJL2Hez1liA7MsruZLoYi3Qkp7wPMOEGIeQu880 WWAA== X-Gm-Message-State: AA+aEWbWLPXO1FKE8Q7mImN9THoH4Qk1mmJOpuunVG2bgEw7/6fnddPX QKpA8DOoE5roxDJR+ja2QLfDl6pxUvM= X-Google-Smtp-Source: AFSGD/XJOHvNFZJd36pFF8ruBqmqd0tK1tY4loJFm2bce1+oi7ZS1w9tFziPJjoysrxrJLetsj1NGw== X-Received: by 2002:a6b:680f:: with SMTP id d15mr17240974ioc.293.1543152603523; Sun, 25 Nov 2018 05:30:03 -0800 (PST) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id b7sm13082027iok.36.2018.11.25.05.30.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Nov 2018 05:30:03 -0800 (PST) Received: by pryzbyj (Postfix, from userid 1000) id 38487804CB3; Sun, 25 Nov 2018 07:30:02 -0600 (CST) Date: Sun, 25 Nov 2018 07:30:02 -0600 From: Justin Pryzby To: Mariel Cherkassky Cc: pgsql-performance@lists.postgresql.org Subject: Re: explain analyze faster then query Message-ID: <20181125133002.GP10913@telsasoft.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Cc: pgsql-performance@lists.postgresql.org, pgsql-admin@lists.postgresql.org Please avoid simultaneously sending the same question to multiple lists. It means that people can't see each others replies and everything that implies. On Sun, Nov 25, 2018 at 03:08:33PM +0200, Mariel Cherkassky wrote: > However when I run the query without the explain analyze it takes forever > to run it(More then two hours). > Is there a possibility that it is related to fetching or something like > that ? If it's a remote database, I expect that's why. Maybe you can test by running the query on the DB server. Or by running another variant of the query, such as: WITH x AS (QUERY GOES HERE) SELECT 1; which returns only one row but after having executed the query behind CTE, as optimization fence. Justin