Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eiJ1I-0001ru-RS for pgsql-performance@arkaria.postgresql.org; Sun, 04 Feb 2018 12:03:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eiJ1F-00018H-S4 for pgsql-performance@arkaria.postgresql.org; Sun, 04 Feb 2018 12:03:37 +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 1eiJ1F-000186-Di for pgsql-performance@lists.postgresql.org; Sun, 04 Feb 2018 12:03:37 +0000 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eiJ1A-0005re-QU for pgsql-performance@postgresql.org; Sun, 04 Feb 2018 12:03:35 +0000 Received: by mail-wm0-x244.google.com with SMTP id b21so20680859wme.4 for ; Sun, 04 Feb 2018 04:03:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=9UnndBGKiXv7u0dnPE2vzh74PtATqd0EXhwuEpHWA+Y=; b=gAb+XFEFHi747vdAkJFnNFBj3/FVh4FG6OYbMlKsymKM7Yjj+nSw05g1sRCDt5hU5+ 4sSGkXP5sLnbbVBLch1wGt4QeMfoMItlyjcwtj96xuLQHC6cy2kSf9MXxGUGfIkZSBPu OGYHPb5EVusciEh3U1YyXC4Nw3BuFAZDnBMtQEufwAlJiNd3oyPRbMY7zfXwYrlwRWtn nmOO9TWjNBv8Eu6YKHQeG6+u6VMEYgMVFe27vKAwqOzZoy/ie96EBwBSH6uelDQSDLsT qFtKIJjr8tqV31BIXAAai8zsSDdyO5cepN0JA9IMv3u2rYBdqQvMs58b4PisUGDBQ56I H79Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=9UnndBGKiXv7u0dnPE2vzh74PtATqd0EXhwuEpHWA+Y=; b=HUCZqDZ0zBkN1sTZVZUeqaItDufUzbXKZVY896vgKPIA8KITQngXmohhBwMtBSkqtc j+yqN9V6RFkmipjQX+jMj0s4xjvcJ5DLmlk+m433Ih+SKk3yvPrPyYaZh8jkUdS/SHri +xbXSR73qlHuK4SV1GhPSSatK50SySV+Z0eqnC0FT597qr1YX1abc94A1BhrNelLroVj RQr9kgkc8zoFd/8/q2/5U+p5PkUIzBn/QT1gTcuu0QavnXF76cVlmiM+PeFSxAIHseWZ nJQU6q/nC8tNelt13FWMFpIWpku/BynqcIR6WBLILsjPSu3AKypPe/7ILF13JYhwzf1T Vrew== X-Gm-Message-State: AKwxytd4yNiifJSi8vm776jlta+vVW1IWSvqqkHOnnmORoDlFsC2XSC4 yPWtWrILE1nY+An1hA0QWnzLJEBk1e9ZlUSdbUhaIBP4fXvvr9QBA21tyFTb2HfKACsbtoL3ahe Tt/bo66q6Ypff2cW7bcyjlTRYfP5hpS+GDoDlVqKMMFK442sX26Pf7UM2pdzqB/UtYGN4emLrL5 PqZYbv5VGK1ok9dfKv X-Google-Smtp-Source: AH8x224s2cl7+1V9igG6zuQyNehr/RWnTmsjTwvsVhkjuAEwqTIJ6elgjFFQs0E/pYM4PZsWu+Cj1Q== X-Received: by 10.80.244.211 with SMTP id v19mr75119434edm.278.1517745810873; Sun, 04 Feb 2018 04:03:30 -0800 (PST) Received: from [10.137.2.17] (cst-prg-88-236.cust.vodafone.cz. [46.135.88.236]) by smtp.gmail.com with ESMTPSA id g59sm5018630ede.19.2018.02.04.04.03.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Feb 2018 04:03:30 -0800 (PST) Subject: Re: postgresql 10.1 wrong plan in when using partitions bug To: Mariel Cherkassky , PostgreSQL mailing lists References: From: Tomas Vondra Message-ID: Date: Sun, 4 Feb 2018 13:03:27 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 02/04/2018 11:14 AM, Mariel Cherkassky wrote: > > Hi, > I configured range partitions on a date column of my main > table(log_full). Each partition represents a day in the month. Every day > partition has a list parition of 4 tables on a text column. > > log_full >           log_full_01_11_2017  --> >                                           log_full _01_11_2017_x1 >                                           log_full _01_11_2017_x2 >                                           log_full _01_11_2017_x3  >                                           log_full _01_11_2017_x4  >             log_full_02_11_2017 >                                           log_full _02_11_2017_x1  >                                           log_full _02_11_2017_x2  >                                           log_full _02_11_2017_x3  >                                           log_full _02_11_2017_x4 > > and so on.... >        > > The date column consist of date in the next format : YYYY-MM-DD HH:24:SS > for example : 2017-11-01 00:01:40 > > I wanted to check the plan that I'm getting for a query that is using > the date column and it seems that the planner choose to do seq scans on > all tables. > > -Each partition consist from 15M rows. > I have about 120 partitions. > > The query :  > explain select count(*) from log_full where end_date between > to_date('2017/12/03','YY/MM/DD') and to_date('2017/12/03','YY/MM/DD'); > > The output is too long but it do full scans on all paritions... > any idea what can be the problem? Is it connected to the date format ? > You haven't shown us how the partitions are defined, nor the query plan. So it's rather hard to say. You mentioned text format, but then you use to_date() to query the partitioned table. Which I guess might be the cause, but it's hard to say for sure. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services