Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fijA6-0002V6-VI for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Jul 2018 16:30:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fijA5-0003bf-9D for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Jul 2018 16:30:45 +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.89) (envelope-from ) id 1fijA4-0003bX-Uf for pgsql-hackers@lists.postgresql.org; Thu, 26 Jul 2018 16:30:45 +0000 Received: from mail-qt0-f177.google.com ([209.85.216.177]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fijA1-00046R-Oz for pgsql-hackers@postgresql.org; Thu, 26 Jul 2018 16:30:43 +0000 Received: by mail-qt0-f177.google.com with SMTP id m13-v6so2165904qth.1 for ; Thu, 26 Jul 2018 09:30:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:subject:to:cc:references:from :organization:message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=rJYX/IoouvhE7JJgXG9tpxliVVAMLTD3SpeP/Ke9qAg=; b=jfwF4B9uStDnrX8X8o/ogdl8zsbuwJIysyy5YNGVxqPBzE09uUOhdpZg+kkT3iGBiU hsCXoSFnTZHsVY61CzMq9/vHWwp4L8aX2Thh55xV1E4JQKPxEEKV+asB2GIc0m81FVpW e3ZiYcoEf7WriPap8YE3NkD+ppeBW4mvsOmeAR5kMyCyVPF6L8RU7O+XHcUyWE01/KR6 jEL6QEYnHMamnt6zvJyLQv9vRfVry3K1lxhbGttsQCj1hLfFuOvnGh/oZx4AWu46IJRO 2XPLaJGvCIBX+v8nheUzawkB22Z/0br/jHwDyLP6rTocLWJ9Fs0OxfJMZvqiyIWkkpc1 QJUQ== X-Gm-Message-State: AOUpUlHKyiJKzCVfy3TnRzjBmn3wnMmQ4uORQi2KoQIc+F6NQrR8tyZh CyxfVYfO7Fo+jUMxkJuJFbiC0jkm9E0= X-Google-Smtp-Source: AAOMgpf8nDRhBXCASKJCuyHNguJb2RcA4zuoQdDbpnRKCMFwpqxxzioELFumnV8W903dvrtZlkffPQ== X-Received: by 2002:aed:39a3:: with SMTP id m32-v6mr2628450qte.109.1532622640104; Thu, 26 Jul 2018 09:30:40 -0700 (PDT) Received: from localhost.localdomain (c-24-61-8-151.hsd1.ma.comcast.net. [24.61.8.151]) by smtp.gmail.com with ESMTPSA id d202-v6sm954246qkb.38.2018.07.26.09.30.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Jul 2018 09:30:39 -0700 (PDT) Reply-To: jesper.pedersen@redhat.com Subject: Re: partition tree inspection functions To: Amit Langote Cc: Michael Paquier , Jeevan Ladhe , Pg Hackers References: <8d00e51a-9a51-ad02-d53e-ba6bf50b2e52@lab.ntt.co.jp> <5a560c9c-3722-1914-f34b-1de0ff3310d1@lab.ntt.co.jp> <20180627121615.GF2667@paquier.xyz> <45e28062-976d-45bf-56f8-9746f551da02@lab.ntt.co.jp> <20180628034341.GH11054@paquier.xyz> <6baeb45a-6222-6b88-342d-37fc7d3cf89a@lab.ntt.co.jp> <4f4a2518-6c62-5463-6ac2-1241ae9d6041@redhat.com> <38183355-ea7c-9443-0c38-6124fcf5f38b@redhat.com> <5686970f-b4e8-bbe5-9109-b97763714c19@lab.ntt.co.jp> <3273a7af-3aca-eb86-cedb-f7b28be00831@lab.ntt.co.jp> From: Jesper Pedersen Organization: Red Hat Message-ID: <2780ebf9-99ae-b433-2d0c-dbca2995956a@redhat.com> Date: Thu, 26 Jul 2018 12:30:38 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <3273a7af-3aca-eb86-cedb-f7b28be00831@lab.ntt.co.jp> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi Amit, On 07/26/2018 04:47 AM, Amit Langote wrote: > Alright, I have replaced pg_partition_tree_tables with > pg_partition_children with an 'include_all' argument, as you suggested, > but I implemented it as an optional argument. So, one would use that > argument only if need to get *all* partitions. I have also added a > pg_partition_leaf_children() that returns just the leaf partitions, which > wasn't there in the previous versions. > Great. > Further, I've added a pg_partition_level that returns the level of a > partition in the partition tree wrt to the root of the *whole* partition > tree. But maybe we want this function to accept one more argument, > 'rootoid', the OID of the root table against which to measure the level? > I don't think that is needed, or it should at least be an optional parameter. >>> Maybe call it pg_partition_tree_leaf_count() or some such then? >> >> That could work. > > OK, I fixed it to return just the count of leaf partitions and renamed it > as such (pg_partition_children_leaf_count), but wonder if it's been made > redundant by the addition of pg_partition_leaf_children. > I think with pg_partition_leaf_children that we don't need the _count method, called pg_partition_tree_leaf_count in the docs, as we can just do a COUNT(). Best regards, Jesper