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 1mWDM3-0001Y1-OZ for pgsql-performance@arkaria.postgresql.org; Fri, 01 Oct 2021 07:53:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mWDM2-0006gJ-AL for pgsql-performance@arkaria.postgresql.org; Fri, 01 Oct 2021 07:53:14 +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 1mWDM1-0006gB-P6 for pgsql-performance@lists.postgresql.org; Fri, 01 Oct 2021 07:53:13 +0000 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mWDLu-0005OZ-UX for pgsql-performance@lists.postgresql.org; Fri, 01 Oct 2021 07:53:12 +0000 Received: by mail-wm1-x32c.google.com with SMTP id b192so6547283wmb.2 for ; Fri, 01 Oct 2021 00:53:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20210112.gappssmtp.com; s=20210112; h=message-id:subject:from:to:date:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=D52Hpe9PJo/7AYUeBNyuzdQST6Z2VBFhNyPkruKX1Gc=; b=xgBLpNBqlHESKq79pGgXdWWgUzAT1DEYrkkIXlAyE/qwY3yLrtgH+1a4efm3JBfbA9 2DEfWyUV3s77HBpLXHGvhPauj7bXBxW7gp6iHZsoPfHb6BtGqxsPHxELftXpg3v4Gevs r0skoSmI2UBL/JdXBB+Snf9IsN9gWWDQye65EZ4AsxbkwOg9Gb1IxeE/Xm4UVnr8cfo5 hZvmjsUt8ND8od0YfFKdIPLeFCDTxZUPK/kkw9u5DxWUgEc8Wwyzo28HSgBT/2hCWu6a fnDzVrCS6NbX3+GxwlpQy6b6bUKvnBBK/JZNSQVL1/1UC4j7IIyqkC7OFI+oNAQ8z/XA UD4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=D52Hpe9PJo/7AYUeBNyuzdQST6Z2VBFhNyPkruKX1Gc=; b=lbYoe+k96LXYEnlThI1K6rs/+WtD3futkQ0uCeJ8nGmw+CqDmvFR8WBExNRxfVih25 2EEt0+vP8Jg3F3o8XEcm+iAmSvr8z15TlXqOgWc3d4cu1g3OOIjhJqHNq4vJ/Vr706FF y8Ohj53zCBwtaopATIoKJuxAx2AWZOjeJV57f+GvG5aRZXbRTQyPcR83vyQhI5JrMIr7 A7rAlUBVqKeJNKHZk/qJaGpbUqtQwaOROh3OdXfWnVXiI64ZRUaWNNvKEoUQcwCFly2r VgGHvnmxXdjGqAyn+KbMvvM5b+rs+MweOOPTlQ/SyRjR/PCoO1DeYI7SxJpfEba3/aa6 0Z6Q== X-Gm-Message-State: AOAM530ytbaJpUW4j3HZyXelTlMgQ4S2n3v6LGzGEsiBmHBnsUTwdts5 8t/VkJZVDx/Ep7Zs5CfnLCFBSieiYdGUXQ== X-Google-Smtp-Source: ABdhPJw9WcPmOQU6E3XR8RFiwjT5UPCM6J89HjHGCBaPqomgF0T8dsYtLQh6mKseMpcUFaJPPdgokw== X-Received: by 2002:a1c:4e19:: with SMTP id g25mr2910059wmh.67.1633074784630; Fri, 01 Oct 2021 00:53:04 -0700 (PDT) Received: from localhost.localdomain ([88.116.133.170]) by smtp.gmail.com with ESMTPSA id v10sm5253379wri.29.2021.10.01.00.53.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Oct 2021 00:53:04 -0700 (PDT) Message-ID: <9b0fc158ae0701e0e3cbd03d7f022735dc4e3f24.camel@cybertec.at> Subject: Re: Query going to all paritions From: Laurenz Albe To: aditya desai , Pgsql Performance Date: Fri, 01 Oct 2021 09:53:03 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.40.4 (3.40.4-1.fc34) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 2021-10-01 at 12:58 +0530, aditya desai wrote: > Hi, > Query on  one of our partitioned tables which is range partitioned on "run"date" column is going to all partitions despite having run_date in WHERE clause. "enable_parition_pruning" is also on. I am > unable to generate a query plan as the query never runs fully even waiting for say half an hour. > > We have composite indexes on run_date,status. Do I need to create an index on run_date only? You need to share the query and probably the table definition. EXPLAIN output (without ANALYZE) will also help. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com