Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dLofO-0000XZ-LP for pgsql-performance@arkaria.postgresql.org; Fri, 16 Jun 2017 10:39:51 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dLofO-0007LH-84 for pgsql-performance@arkaria.postgresql.org; Fri, 16 Jun 2017 10:39:50 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dLoda-0001bI-F0 for pgsql-performance@postgresql.org; Fri, 16 Jun 2017 10:37:58 +0000 Received: from loire.is.ed.ac.uk ([129.215.16.10]) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dLodX-0008Kd-AF for pgsql-performance@postgresql.org; Fri, 16 Jun 2017 10:37:57 +0000 Received: from hbdkb2.is.ed.ac.uk (hbdkb2.is.ed.ac.uk [129.215.234.33]) by loire.is.ed.ac.uk (8.14.7/8.14.6) with ESMTP id v5GAbqfP025232; Fri, 16 Jun 2017 11:37:53 +0100 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (213.199.154.177) by exseed.ed.ac.uk (129.215.234.33) with Microsoft SMTP Server (TLS) id 14.3.352.0; Fri, 16 Jun 2017 11:37:52 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uoe.onmicrosoft.com; s=selector1-ed-ac-uk; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=yrQcQEv9NJAXgtvGl9GXOcHUe4WPuYuENsRkjDoXT88=; b=KIzcrER7a5SBOp+Ji/aPJt1cba+SSETxF8Io7KASisLWRml6dvtNlInXSUYBMgU/ZJQFD3GE0LM4U5OX4/SEG5V6ItLjg4th0SqPvottr2ghFd958rdxMjTN98RaxRYwiiiHcB++NYC2Y67xhW8EL3TtWqbVIGC7kT/MEOY7A3U= Authentication-Results: postgresql.org; dkim=none (message not signed) header.d=none;postgresql.org; dmarc=none action=none header.from=ed.ac.uk; Received: from [IPv6:2a02:8109:a5bf:ee5c:433e:2de7:225e:8fc] (2a02:8109:a5bf:ee5c:433e:2de7:225e:8fc) by DB6PR0502MB3016.eurprd05.prod.outlook.com (2603:10a6:4:99::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1157.12; Fri, 16 Jun 2017 10:37:50 +0000 Subject: Re: Using array instead of sub table (storage and speed) To: Stephen Frost References: <35a68a4e-9567-dc48-5d76-078112e558b3@ed.ac.uk> <20170615133704.GQ1769@tamriel.snowman.net> CC: "pgsql-performance@postgresql.org" From: Lutz Fischer Message-ID: <867b4235-95ba-6910-8224-824f75f7ce99@ed.ac.uk> Date: Fri, 16 Jun 2017 12:37:47 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20170615133704.GQ1769@tamriel.snowman.net> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [2a02:8109:a5bf:ee5c:433e:2de7:225e:8fc] X-ClientProxiedBy: HE1PR0202CA0023.eurprd02.prod.outlook.com (2603:10a6:3:8c::33) To DB6PR0502MB3016.eurprd05.prod.outlook.com (2603:10a6:4:99::11) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB6PR0502MB3016: X-MS-Office365-Filtering-Correlation-Id: bc6b08b6-71c8-4835-d203-08d4b4a3bda5 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(201703131423075)(201703031133081);SRVR:DB6PR0502MB3016; X-Microsoft-Exchange-Diagnostics: 1;DB6PR0502MB3016;3:x3kIksfHWWk0m3Y72UxUUMAQzDGN8qsq1o3kpu+wcVu96CwK2WdaMoc9WtCij5jldGm7dGFAoBwILz2wOD4Z4qW1+C56uRubd5l10BsvAzuEby0kHH3VpWeR1Osf69J5GVCE7ZeU054A4q3dKpSsVUPsQTemdppbil0ktdb8FGjbrWASYFoqNFDyCMALTba3MNty6W+VzEAedXxw6eM735GgljrkS6EoPKZ1FnAheTNQjopmUb2ZuKGJlfNYzmJAs+hT9cpnLyASwzl7GX3pUwGATLPdudhbGDwTeNCgkXEys48udtmnAqERBdSSXYi4nxBjnJfC8wdBhxnJ3mgR9w==;25:HqpQ6ERcahvHYEgaYX1E80Pa1e3eKfN7Q6mDpYgLHvHGz9uv+abh9pjqXKtlXH+jTt8bITCqjVC+7dPVfv5MsQUJRFbSHpaTkPX0b2OBefJlFxdlLEcixQyV+snKV8gcS2unlj1g7+SOYmWL/Sf4dVSyzzSl149hieqoRmVcNG/AYeLuOpkx7aVtrALq8WohCjE03xOUyH2AWKkETo9poGwwK+pU1yXsri7BabreulAImq2ZiiINrj9tXbTXi+6Hd2qsPXewSUOGouMe15nRt9IJUfn2S3Fvkd7B5c76zD1RU2QFFURPBgTX/jp3m/e/jqEBrlopOCYPm8zcXJ/6lRZyM3VtGQvexkrjkPx0CbIsYI/Aiilrnp/ak/NvpF/BTzsaTJshwzsjRQwbT3G740eX+t87HTvjlM1f9sCXXHEVuhsi49KnhfMro+EDcFAFvMSA+H/3pLBnqD14Rwe3DOaxG/VSiocVefADrL8WuMY= X-Microsoft-Exchange-Diagnostics: 1;DB6PR0502MB3016;31:8wOlbfIYIBcxpXCTzoKJdidqTy/K/uWUE3ZN/Z0jEh4lMwxYpa1OY/mAKnLwK7hNinYIBC7IK4WI+sTY9PLVH0HE62R4NrHBfIOI6AFypDOMddOE3peru+shNjVIEwmLprdvIlm0IGXQIlM2rUauTrSNBrcqYQNlZrSgBbuOV851rlPLn3NI796Z2aPIH6sY5COuv8+zceGUlmMZ4ljh2AdcncVHchw5OeZzHgUWUqBXHkD2RtCxH+2g6WW1vpSp3tgz9J727P3Yb7cQeXuoWA==;20:Cz9ecBSQ6U4VWhEUxzSAvqruGX6CrKTFRJhrhb8QefO+3GHIZS4nuDi0NSDtmu2sFVKF8ye5XPaXJSx1bRIcuetQTpcxJJqNpamx+jLxvUSWaHn5yzLoMlF4kSn6TJENa/ijoSdylcOAMjJCmuGCHrGDJUQEczgjvtCX6DYgm7dhv3zHSohp08KhWatV20anXA1lTgIKEj0RMfcwUFRwpA2MSVgIbjl0/NARYS4A6zmZsYc6PI2WrYWuB5dL1/zQVF2u23XEWxbT8rzRWnqNFJLJw3vnD03/TgkPF//P6OqmiD1lS56BXFmW+cntZ2Cstr6mFIvbTTXtMOaHVN00L0eO5xGdSncHrCLZfgu9lIS9uyVdSbbd5MeklWta0WWOnSsdDUo4Ium9Qgr87hVz+2x3OLqg7pErAlovkdvCVSvpEjD/2Z2WMPbWqHRmwl/w X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(181193635805523); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(100000703101)(100105400095)(10201501046)(3002001)(93006095)(93001095)(6041248)(201703131423075)(201702281529075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123564025)(20161123562025)(20161123558100)(20161123555025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:DB6PR0502MB3016;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:DB6PR0502MB3016; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;DB6PR0502MB3016;4:WYPVfsK+UsxKl+xZgVI/1KA9v7hrq1nE/3uR?= =?Windows-1252?Q?4/RxUjZX/Wd7IIKXnRI6I90YLjgIyzCpfP8MPDdAmal9nfERi/+GOo1c?= =?Windows-1252?Q?MQfug0B8cqMUZywdg0Yo4QU9cwL/ANL21eszWvByt0iQEYlD0wozuxih?= =?Windows-1252?Q?zD8Gas6dR9Lg1VCHAqe3HFsahrWQoI8UxNOYP5E2tF1epmoNY/2tqwOP?= =?Windows-1252?Q?y2XonNQNCnqCHXpGrBgpStTnipu0Dx48NE346cH50cJ2rWAAb28wqR69?= =?Windows-1252?Q?4GcRSP0m1I6v/YOLAI/kotEo/qUXMH6HmpnO61MCPTPhrsJ2lbmv5WwV?= =?Windows-1252?Q?fZE7itYvSuC3N0tjlc/cRYOlkFUQbcUIPCGqwvDs3in7U5zLl/q1wlyW?= =?Windows-1252?Q?v/TJyxrzXC6H9fzzQK2Jvd1i/+dD5b/1Yt/oM0DUa7JajUJZ0s7qrSBq?= =?Windows-1252?Q?KSub6pgHo8hN4B35BZOKM/Bk07uoEfxQ3e/C6yBxofCbZWnZwN8MRFFY?= =?Windows-1252?Q?/pw/0sfDoCJJoAm+aq7SBgAPhrY4TncdhPD/ZYyV8ij1eNZoc97Lv1Ap?= =?Windows-1252?Q?akm5hf9F/n9+HH3ZoVMtuVawMThEvMrvqSn/aPP/fTjN1bNu+oqSH+in?= =?Windows-1252?Q?QcgUn0IY56iNFVR77j8tJyRGEToyuuO8oQy2TNbEG+nzK48OIRhH7fIF?= =?Windows-1252?Q?1BhgN9YTR0HIfeU3ewIfqQYkzKm6wh1cr5GHCz8+mJIBa7Lhc4OU8dPc?= =?Windows-1252?Q?x8nIK5csS+Wd/XXYNHEck1XP7clM/cB46hj5gceTQcxzrIVrwio27r/X?= =?Windows-1252?Q?Zm+XW5/VaGvNq2GcVfYBpckZoXHf+jjJYHF4BU1pReTZWKhj3IKE3GK1?= =?Windows-1252?Q?El9GX+eCBhgzEQrLf/39W5PmBmAFESCs54f5OjzJIKeBlwXzc78KlOtI?= =?Windows-1252?Q?WByuYt6g3wMmI64DkFOf2P4b11E41r+gnwQCvVf32bzWoy01ryCjWJLM?= =?Windows-1252?Q?UDqWfzDM6H66LGRqEpuvfrI1PdDyFwtM1SeRC29f6Uf3xHUwAYdEbgHE?= =?Windows-1252?Q?kO7CWEfpNcU3jLdaq0eyf0Xq4tNPy7gZV3K+rP+pCxniZdcT1rke+g22?= =?Windows-1252?Q?L1XVqkxs4wvlCL3iznRdlIzzSD92Yn9gJIJA4RGKGVANn6+sfjAu3uYg?= =?Windows-1252?Q?00qfwE2WeZhMbMIx3Ype+9C7uICYcU3Z1Su9SXB1NSLPISqCp5+pwFMU?= =?Windows-1252?Q?kjyQ9Mm13OT22dJUtXEAtnU2jDmex3zf8E/JqMHk8P/YpFYO2/H8pVf2?= =?Windows-1252?Q?2DGaCLOnisEMEBtFORwI3S2A2g=3D=3D?= X-Forefront-PRVS: 0340850FCD X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(39400400002)(39410400002)(39840400002)(39850400002)(24454002)(23746002)(83506001)(478600001)(189998001)(53936002)(6116002)(50986999)(76176999)(6246003)(54356999)(86362001)(6666003)(31686004)(50466002)(2950100002)(110136004)(2906002)(42882006)(38730400002)(31696002)(6916009)(64126003)(33646002)(47776003)(42186005)(53546009)(7736002)(36756003)(229853002)(81166006)(74482002)(305945005)(25786009)(5660300001)(4001350100001)(4326008)(65806001)(8676002)(65956001)(6486002);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6PR0502MB3016;H:[IPv6:2a02:8109:a5bf:ee5c:433e:2de7:225e:8fc];FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;DB6PR0502MB3016;23:iFOIgOmu1JzbGhujyuMD0AWBetJvWueUdUm?= =?Windows-1252?Q?rohUKwx7n/g2DbJ9VKlhLFMe1tOhqSAINTkA72vynqCo2SIrbXw+cgad?= =?Windows-1252?Q?zVp9mLayp8SXRbHzn+dr5tjGouIPmkb1h1s/dBszLzCYMJgAqmgGyGG8?= =?Windows-1252?Q?E4z8NVHctlHxNX2/dr2HgWri/VLbPfMTj0L0eJ3WAACjq1+BYXFmCSWb?= =?Windows-1252?Q?1/MYyk/SOiUJfGIOZSovWx+bRBHjSJQgP+HbmekYidpZYcNEs1XDy8Qo?= =?Windows-1252?Q?DE4OvuZPa8+Xg+JS6tQpZiGuOa15jnnEfOyX+sU4fn7hYYtQJ0f3l0oQ?= =?Windows-1252?Q?ddwXfEXsjUofREA3nsVGNXMGyKtanY1R6Cqk5/6GwLfRvub3mIlXJftF?= =?Windows-1252?Q?Cc9S0CvpYJ7O99mu7Vo0aF8SuOetLyfMrWXg5Brt3RFzDqkyplYcTzMw?= =?Windows-1252?Q?bcBkchUoaOhMFUc+psA5IO/ic4fbTpPKTKQf9VEJyRUK5k0zxPbnOI+p?= =?Windows-1252?Q?q++Zn5BtYSRaJXoMIP2BsJ+oREtmK7dp3ZupbOHm6THrSvOuVOO5GVAA?= =?Windows-1252?Q?J3ulGRaQXoRlYO4JYb5eUFbLEfJ0faxXKRs6LyFq8L3c4tXy7ln1EZND?= =?Windows-1252?Q?/Yanx2TdEmitV5eGDx4YZ6SkYOt8dap4DlIZ7SRb3vlDzpFRHIaxZjTf?= =?Windows-1252?Q?h13tLjnUB6A3nM+iAfTgnINvAU10AW8jkwvNpbwkRYn+ixhGzGzKAbhp?= =?Windows-1252?Q?O/uOrw7zfQCIbrW93A8r32IJbR3HZZ7wiXX0eV3e94zqTCbiZ+BSvqjR?= =?Windows-1252?Q?1wTGy1UbnB8rdtlqVIZh68oqVx57DAr20ZOviRidYPMDNTvwb7lUn6/+?= =?Windows-1252?Q?AF3jYAbGVsZkzDCGkjLK0qRPjsYCKETyqMil67Y3GhwnJ5V0+20fSlmE?= =?Windows-1252?Q?ivZBlXECFk/279N4/yNzap9u3OM/k4wdnwg1H6xVkJYcKSOCmwgW9C1N?= =?Windows-1252?Q?VjcJKz9OtBbEuscde9GYb5OQIqwtIT3ExW94WPfQYVCgbiEyG2q4hbVv?= =?Windows-1252?Q?ignWyi4NIULmH26yZTltgh5leTnnyFiCm1fuHWMKIjnjqt2c7UhPEJtW?= =?Windows-1252?Q?BvrCFNMDZQV8KQ9ODu+k9f8sG4InHfI82sX5lOUVLyPI7MzMMoVaZ3ac?= =?Windows-1252?Q?kfKKi8MCal1q88H55v6n9/n+ZnLbsZzPjH5az1p+5x2GNiNi0ipkR8cr?= =?Windows-1252?Q?Gv5vIYL8IE8JUksuuMAodEBehQWoVrOJIEL2PehA=3D?= X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;DB6PR0502MB3016;6:ZFRsQH0iP0BHh2br2wCl1TsS1XJF9UrNEvj6?= =?Windows-1252?Q?2LbqjcqGIx6kUhie1ngSn6/ROVV8F45GiBvSHH9+UIkuo1s+epgMPVrD?= =?Windows-1252?Q?WT4thbv1Q2g2HnnFVrpCriCwQ9yHOKzsRFb6ANCI/j+cj0aGhU7Z9VLx?= =?Windows-1252?Q?DvCqZLnWqiu6UWfLyp+hXD57NIRJ3lrwx/CRDtxSXX/QQE/KYOc3RJrI?= =?Windows-1252?Q?U/4S7fa5Mf2jDIWY81mExkNWAh6fH7wbCvymx8YpDLuAjTJC2z2iKLh+?= =?Windows-1252?Q?gPHe03QZIe5S4UtGnmOv6UyLf+kFMmrQRHUzLR0t9qRiC/0Tncvgi6mP?= =?Windows-1252?Q?Gi8maoI01wMcg8mTS8rY0hAl9JytVYtqNyiNG2Z/rHvUBmTfa+AZmWK1?= =?Windows-1252?Q?6iPa36Q9VJfIG8pSA9bWxLLzum/uzgwXiuCFPm4wTwBqkcVQMo0TO2zl?= =?Windows-1252?Q?PAPCqz/uMUzLxa/78neXOaXQezou4hM6mczyLGg0zSqJnHESzRVVBb2d?= =?Windows-1252?Q?ajCa8nNJgBe2+uJzE7OSGF0UU7vUeztWxm/aAuN42ckJFkFHjin1jiak?= =?Windows-1252?Q?zpVGWQVUGBnOaLbIdM3YYLxUz43FZqPB+Z751vw+zPPxp+PgX/MPMZLK?= =?Windows-1252?Q?4nl1cQEqu80CSCmlmlOJf7XgEukXJtPFztDHBGzHRW5v6jHz7mGV+ifn?= =?Windows-1252?Q?DvfzGQZyOet+Gvas7bzdPGI2JE4bNcZu8wVdtEwgYdhUgEHHckSF63Ri?= =?Windows-1252?Q?A9QY+fhAu8rbxP3Nd9vwayF8d285L0PnmnlF7Cve1STOUk738ByGEv/8?= =?Windows-1252?Q?kilGSu89mthwmNeksDF+9cVEncvvzwSKxZ7QVE5TunOeK5jGveZmNCfY?= =?Windows-1252?Q?/Qe4/i+XHrZGXeyg62RERiR3+xeoSHpDieMXsixRTPs9IZXi/5M2OfRz?= =?Windows-1252?Q?TLhs5fYmSsNMrMX9tCFVYLjgv5fJOoYxIgDk7Vj5KbtRafjVbIQKMTdC?= =?Windows-1252?Q?vUCPYF4HxLM8LxNHaKUPc1W3AKAraUNhkU08A69W4MAJ/vAvaF9tLngx?= =?Windows-1252?Q?B+tygznrrQbX3Zo=3D?= X-Microsoft-Exchange-Diagnostics: 1;DB6PR0502MB3016;5:HCXDYMNJJWKsRHqmtOmAO7mJC8L3VjRMVPG89Ixslb3d2FpxP17Hbw53cyvzwPSxmMZYVjDePCI2NhTpZ9O28ZvKmURPFy3mXR0pHzbUGWGJGu+jaiwj/5vM4uvlPqa/y8uRbtzYYy9x2ocUlu20jQkkfY920RK4BXZ3ob3UKmhbSYUx/H8aVGG2vu0vxr+aq/LTsHXZowXuazprHZOtcbzk0iDPrBN+qj+Wz4lWNSVzY+B0qgC5jEImo6Tt/oT4QzL/vX8VqQua9O8XNhFyiaqTqYAZayluhYc9YV305sfaubZa9m/1D63Mt43936zBiB3tllDoLJe2vzz/HY+kMGvOL6XfDq1KO9nO1tXW07QST/wDPkYKt5WsJiweFMvZp6xM+33hW/UY6vDqI/qGLtJZ9cWXiKpU6a7LWglZlmBuMLkjlFDSJJNYaU1WhLRSVzeamJHoTtxjP6qp/Vnht/ccWbErnsPO0cv+l2kbBe4sMntSaWVwRtC3r/DTgdIR;24:+x9TydxkVtPwp3H/5l20CY2uj3MPeSp/bklC5W9fuBZFNn+nj8IQCtzIg8XrT8/EUntXPR+h39HKgnV7tVhrs0Vhqc7zyFgN7VPocdcfEGI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DB6PR0502MB3016;7:J89INL8x0AtvP+fr5H7RLPKC5T0dWJ/TCMPOJai+Q1lCpHHRarL/19Tdli7V0/ey2h0GzChCnsdrXENEV8sEVfaUkTo8smQs+9KEZQb3isgPa386VFKlfkfeSRtvhNXrnuHs3hiN0GA9U0SMIlfpTBNXtCp8PT7eDQe2hhTEiLbBP63VJ3x/THT0uRqBX6/fDzf5B9fEKDA7m8NrhtIcOuAoYLUWyn2cOW1lB6pz//Tc0XBNRxRe4/AxNBh2DPaRzYIv3qnaojSuC8usu79poWCW8Pm/888gFstMF+HcFrOPmYZxzbflC9TkDHvjHOoGWGTTAYVs+GfyjVk2iQqKZXGDomffOqGU0tkggp+E5QR6OOU2AITgv8dKffjKPj+XE2D1tmlC9JuEwi9ivDPEY0VRuvwRh3w1QQL11Yzjn4rSn8YudwUgk+f8EvJCpK4L1MGpe1LXX7j1uHTfKEaVm3ifxitYCtAxpR1XOdnLczQwbpVKWye4J5ltKSV5VRwgcS4/OFR4Da/2HTqnf5jFtJw0zDMydF9OfHrcJS1HlPo1+FtD5ERVpNqc9ID/MivJ7iE4stY0naBePXJhdBo+d7CO8z9eF8eweTr58ouoGwkxb+dXkbbbv9/+R9o+L3VNUyuGIUJ+qG6dM8EmSgmvy6R01/Nf6YO8X/TXPyMf0ELwSQTiyqLZut7efTvcNMnfJNpMZwGtk1atSWgEg1XFIrX99sCyg+7ZbmUufnYDWEmtrlp91d81udTRudt2IF+IBdHhAdcTFFjvnS6OtBrFvzTQZ6bC7nFOyTOzudcG4R0= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2017 10:37:50.4098 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0502MB3016 X-OriginatorOrg: ed.ac.uk X-Edinburgh-Scanned: at loire.is.ed.ac.uk with MIMEDefang 2.78, Sophie, Sophos Anti-Virus, Clam AntiVirus X-Spam-Status: hits=0 required=5 tests=LOCAL_FROM_ED,T_RP_MATCHES_RCVD version=3.4.0 X-Scanned-By: MIMEDefang 2.78 on 129.215.16.10 List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org Hi Stephen, Thanks for your reply. The data in the sub table (sp) are only read in as a block. Meaning I will always read in all entries in [sp] that belong to one entry in [s]. Meaning I would not lose much in terms of what I could do with the data in [sp] and I could be saving around 2.8K per entry in [s] (just counting the overhead for each tuple in [sp]) per entry in [s] One thing I would still wonder is in how far this would affect the performance retrieving data from [s]. I often need some data from [s] where I don't care about [sp]. So in how far does having these arrays a part of [s] would make these queries slower. Or would be better to store the array data in a separate table e.g. have [s] as it is now but turn [sp] into an array aggregated table. Thanks, Lutz On 15/06/17 15:37, Stephen Frost wrote: > Greetings, > > * Lutz Fischer (l.fischer@ed.ac.uk) wrote: >> Data in [sp] are never changed. I can probably reduce the size by >> changing datatypes from numeric to float but I was wondering if it >> would be more efficient - primarily in terms of storage - to change >> the structure to have two arrays in [s]. E.g. > The short answer is 'probably', but it really depends on how wide your > rows are. > >> I haven't really found anything yet how much space (e.g. how many >> bytes) an array will use compared to a table row in postgresql. > There's a 24-byte overhead for each tuple. If the width of the tuple's > columns ends up being less than 24 bytes then half (or more) of the > space used is for the tuple header. Arrays have a bit of overhead > themsleves but are then densely packed. > > In testing that I've done, a table which looks like: > > CREATE TABLE t1 ( > c1 int > ); > > Will end up with a couple hundred rows per 8k page (perhaps 250 or so), > meaning that you get ~1k of actual data for 8k of storage. Changing > this to an array, like so: > > CREATE TABLE t1 ( > c1 int[] > ); > > And then storing 3-4 tuples per 8k page (keeping each tuple under the 2k > TOAST limit) lead to being able to store something like 450 ints per > tuple with a subsequent result of 1800 ints per page and ~7.2k worth of > actual data for 8k of storage, which was much more efficient for > storage. > > Of course, the tuple header is actually useful data in many > environments- if you go with this approach then you have to work out how > to deal with the fact that a given tuple is either visible or not, and > all the ints in the array for that tuple are all visible and that an > update to that tuple locks the entire tuple and that set of ints, etc. > If the data isn't changed after being loaded and you're able to load an > entire tuple all at once then this could work. > > Note that arrays aren't more efficient than just using individual > columns, and this technique is only going to be helpful if the tuple > overhead in your situation is a large portion of the data and using this > technique allows you to reduce the number of tuples stored. > > Thanks! > > Stephen -- The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance