Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tXMaj-005qsg-4K for pgsql-general@arkaria.postgresql.org; Mon, 13 Jan 2025 15:43:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tXMah-00B13S-3d for pgsql-general@arkaria.postgresql.org; Mon, 13 Jan 2025 15:42:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tXMag-00B13J-Pf for pgsql-general@lists.postgresql.org; Mon, 13 Jan 2025 15:42:59 +0000 Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tXMaf-000CAb-0o for pgsql-general@lists.postgresql.org; Mon, 13 Jan 2025 15:42:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=depesz.com; s=20170201; h=In-Reply-To:Content-Transfer-Encoding:Content-Type:MIME-Version :References:Reply-To:Message-ID:Subject:Cc:To:Sender:From:Date:Content-ID: Content-Description; bh=EHUFC392SmC9LO4/JIzMxCDD8Y5Zi7dSyHWG95o/vns=; b=EB+5K G5jtL5U3Y7d/uDMsrvZJmGZqZxS83QNDmr+C7fR37OYCrin/NkyvAQogwJH/et9jbot5njtAvawnH WKKbRln35gWOvjn97hZV6L8YG8n9z0O5rBSp45kpLclNpdBhT4jjGuq7G2430ikFlImlEMCtH9SW0 w59/ZHtkDKpg=; Received: from depesz by depesz.com with local (Exim 4.96) (envelope-from ) id 1tXMae-00FJiA-1U; Mon, 13 Jan 2025 16:42:56 +0100 Date: Mon, 13 Jan 2025 16:42:56 +0100 From: hubert depesz lubaczewski Sender: depesz@depesz.com To: =?utf-8?B?RcWfcmVmIEhhbMSxY8Sxb8SfbHU=?= Cc: "pgsql-general@lists.postgresql.org" Subject: Re: About PostgreSQL Query Plan Message-ID: Reply-To: depesz@depesz.com References: <1348181736777057@mail.yandex.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1348181736777057@mail.yandex.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Jan 13, 2025 at 05:26:09PM +0300, Eşref Halıcıoğlu wrote: > Hello, >   > I have a query in PostgreSQL and I want this query to retrieve only data from the last 3 months. However, when I examine the query > plan, I see that all partitions are listed. Please note that your explain is for update, not select (which "retrieve" in your mail would suggest). > This raises a few questions in my mind: > > • Are all partitions really being accessed, or only the partitions of the last 3 months are being accessed while the other > partitions have to be shown in the query plan? Not really possible to tell without reading explain *analyze*. Potentially all. But perhaps just fewer. Best regards, depesz