Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YlLZp-0000y6-0K for pgsql-hackers@arkaria.postgresql.org; Thu, 23 Apr 2015 18:10:17 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YlLZo-0005N5-Bm for pgsql-hackers@arkaria.postgresql.org; Thu, 23 Apr 2015 18:10:16 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YlLZl-0005JX-Vz for pgsql-hackers@postgresql.org; Thu, 23 Apr 2015 18:10:14 +0000 Received: from smtprelay0087.b.hostedemail.com ([64.98.42.87] helo=smtprelay.b.hostedemail.com) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YlLZf-00022D-Td for pgsql-hackers@postgresql.org; Thu, 23 Apr 2015 18:10:12 +0000 Received: from filter.hostedemail.com (10.5.19.248.rfc1918.com [10.5.19.248]) by smtprelay02.b.hostedemail.com (Postfix) with ESMTP id E3FCCD3811; Thu, 23 Apr 2015 18:10:05 +0000 (UTC) X-Session-Marker: 616C76686572726540616C76682E6E6F2D69702E6F7267 X-Spam-Summary: 10, 1, 0, , d41d8cd98f00b204, alvherre@alvh.no-ip.org, :::::::::::::::::::::, RULES_HIT:41:355:379:599:960:967:973:982:988:989:1260:1263:1277:1311:1312:1313:1314:1345:1359:1437:1515:1516:1518:1519:1534:1542:1593:1594:1595:1596:1711:1730:1747:1777:1792:2198:2199:2393:2525:2560:2563:2682:2685:2691:2692:2731:2828:2859:2898:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3355:3865:3866:3867:3868:3870:3871:3872:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4362:4605:4659:5007:6119:6261:7903:8634:8957:9010:9025:9121:10007:10400:10848:11232:11256:11257:11658:11914:12517:12519:12663:13156:13161:13172:13228:13229:13894:13895:14040:21063:21067:21080, 0, RBL:none, CacheIP:none, Bayesian:0.5, 0.5, 0.5, Netcheck:none, DomainCache:0, MSF:not bulk, SPF:fn, MSBL:0, DNSBL:none, Custom_rules:0:1:0 X-HE-Tag: boats20_580922d3a332a X-Filterd-Recvd-Size: 3897 Received: from alvin.alvh.no-ip.org (unknown [181.43.17.179]) (Authenticated sender: alvherre@alvh.no-ip.org) by omf12.b.hostedemail.com (Postfix) with ESMTPA; Thu, 23 Apr 2015 18:10:04 +0000 (UTC) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id E4EFAA7E; Thu, 23 Apr 2015 15:10:41 -0300 (CLST) Date: Thu, 23 Apr 2015 15:10:41 -0300 From: Alvaro Herrera To: "Joshua D. Drake" Cc: Jim Nasby , Andres Freund , hlinnaka@iki.fi, Petr Jelinek , Robert Haas , Bruce Momjian , Sawada Masahiko , Greg Stark , PostgreSQL-development , Jeff Janes Subject: Re: Reducing tuple overhead Message-ID: <20150423181041.GL4369@alvh.no-ip.org> References: <20150423162429.GG3055@alap3.anarazel.de> <553920F0.8030206@BlueTreble.com> <5539253D.8000506@commandprompt.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5539253D.8000506@commandprompt.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Thanks for posting this. Joshua D. Drake wrote: > First of all I should note that I discussed the approach mentioned above to > pgsql-hackers and got a very interesting comment from Tom Lane that adding > sorting info to Var and TargetEntry nodes was not a very good idea because > it'd break stored rules whenever a table column changed. So I went back and > studied that code and noticed that it was really the change in > RangeTableEntry that's doing the good magic; those other changes are > fortunately not necessary. (Though there were a necessary vehicle for me to > understand how the other stuff works.) So in the logical columns thread I was saying that this change of eref didn't work either; it seems that most of the time (if not always) the list should continue to be in attnum order, and the logical-ordering-info data should be obtained from the tuple descriptor and whatever needs to be sorted should be sorted afterwards, i.e. in setrefs.c, using data previously stored in RelOptInfo. I tried doing that and ran into some other mess elsewhere. > I've been continuing to study the backend code looking for uses of attribute > lists that assume a single ordering. As I get more into it, more complex > cases appear. The number of cases is fortunately bounded, though. > However, some other places are not like that. I have "fixed" SQL functions > two times now, and I just found out that the second fix (which I believed to > be "mostly correct") was to be the final one, but I found out just now that > it's not, and the proper fix is going to require something a bit more > low-level (namely, a projection step that reorders columns correctly after > the fact). Fortunately, I believe that this extra projection step is going > to fix a lot of other cases too, which I originally had no idea how to > attack. Moreover, understanding that bit means I also figured out what Tom > Lane meant on the second half of his response to my original pgsql-hackers > comment. So I think we're good on that front. I had forgotten my intention to rework things using projection. In any case, I have posted a lot of patches now which others could study, if there's interest. I would sure like to see this split, and there are multiple benefits such as reduction of padding space. I'm sure there's a nonempty set of guys brighter than me that could figure it out in not that much time. -- Álvaro Herrera http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers