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 1fmH41-0001Ev-4Q for pgsql-hackers@arkaria.postgresql.org; Sun, 05 Aug 2018 11:19:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fmH3y-0002je-6z for pgsql-hackers@arkaria.postgresql.org; Sun, 05 Aug 2018 11:19:06 +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 1fmH3x-0002jX-SS for pgsql-hackers@lists.postgresql.org; Sun, 05 Aug 2018 11:19:06 +0000 Received: from mail-lj1-f172.google.com ([209.85.208.172]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fmH3v-00011k-56 for pgsql-hackers@postgresql.org; Sun, 05 Aug 2018 11:19:04 +0000 Received: by mail-lj1-f172.google.com with SMTP id p6-v6so8352635ljc.5 for ; Sun, 05 Aug 2018 04:19:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=5CYC4rJObMvX9Qj4nXDeF6nMKRLDJ9h9hiTZ6hqhd6U=; b=SAyfj1gkSkzHIWaiDhUUKSU5PoLOKLOd3qAVEpl7YDWrks9ANvbTu4wZPOMOzddTA5 4aIeQ4123I6zZr1jKoCQJgRmqAvN7uK+UFNWrDJiYO52LwW8WbT3fDuJX17hfoqkRsk2 fIOtNzyESHbEsnLs1O6Ko26TVy0CoJeB5VTCsvGWB+O/2vqTK+8GDFH4lr057YmIt0Z5 FUsBSY8ud4mt8anfpDIrBa5y8dlEofa8YD773u8ZLOGN9Q826fR/abV0YXsC1lA85wk/ 0XuA9sJGjinqzRlfBcNpY9iO3IFh2djqeNOASQgX36E0zvMoNKYnXOwA6ug/URhqpaXE E4vQ== X-Gm-Message-State: AOUpUlExHCwN5X/gfjqQYTwuOgHTF65IUudksLUXiSNQwCUVJ99nEYRe ucf5VTyHH8maNaeBRpZJVtw= X-Google-Smtp-Source: AAOMgpcaQR0gp4R6NkkU2am1xJBL2pKagSCDM3ffruXPeL7j1ssw4Txym74Iq76LhXlePGCJHupYJQ== X-Received: by 2002:a2e:9bc9:: with SMTP id w9-v6mr9692618ljj.33.1533467941425; Sun, 05 Aug 2018 04:19:01 -0700 (PDT) Received: from [192.168.1.11] (dsl-hkibng32-54fbf8-78.dhcp.inet.fi. [84.251.248.78]) by smtp.gmail.com with ESMTPSA id n7-v6sm1600897lfe.87.2018.08.05.04.19.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Aug 2018 04:19:00 -0700 (PDT) Subject: Re: GiST VACUUM To: Andrey Borodin Cc: Thomas Munro , Robert Haas , pgsql-hackers , =?UTF-8?B?0JrQvtGB0YLRjyDQmtGD0LfQvdC10YbQvtCy?= References: <77c7023c-18d4-8f04-08ed-a5c5633046ea@iki.fi> <50d0105a-bd99-788e-37ee-51f59d81fbec@iki.fi> <0E0DF52D-8E01-4A37-A9C5-3B9A7E6E53DD@yandex-team.ru> <2DA06ECF-EB35-49B3-9F8D-4BB1800B755D@yandex-team.ru> <66dffd3a-b9d5-65cf-15bf-615a83b44301@iki.fi> <5A3FD588-BC51-4FC3-B9C3-19453F824C68@yandex-team.ru> <927581532000526@myt5-31f0319c46b9.qloud-c.yandex.net> <266d7c7e-7431-b6dc-e4af-7ec9f08b5e52@iki.fi> <479336FE-B713-4DFB-9661-9BFCCA70F4EF@yandex-team.ru> <51675201-3F1C-4796-ADB4-28D0B35E9CF0@yandex-team.ru> <651572F0-65C3-4285-85FC-50E81B1199F1@yandex-team.ru> <2AF4B7F1-ABCF-4602-8AF8-06EA45191BFC@yandex-team.ru> <844f3373-486e-a34d-d5a1-6a048e19355c@iki.fi> <4A1FF988-A69D-4607-8A6E-B3EC0FD6C2CF@yandex-team.ru> From: Heikki Linnakangas Message-ID: <43f15ab5-dd95-97d4-658b-e9954ca986a6@iki.fi> Date: Sun, 5 Aug 2018 14:18:59 +0300 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: <4A1FF988-A69D-4607-8A6E-B3EC0FD6C2CF@yandex-team.ru> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 31/07/18 23:06, Andrey Borodin wrote: >> On a typical GiST index, what's the ratio of leaf vs. internal >> pages? Perhaps an array would indeed be better. > > Typical GiST has around 200 tuples per internal page. I've switched > to List since it's more efficient than bitmap. Hmm. A ListCell is 16 bytes, plus the AllocChunk header, 16 bytes. 32 bytes per internal page in total, while a bitmap consumes one bit per page, leaf or internal. If I'm doing my math right, assuming the ratio of leaf pages vs internal pages is 1:200, a List actually consumes more memory than a bitmap; 256 bits per internal page, vs. 200 bits. An array, with 4 bytes per block number, would be the winner here. > But I have to note that default growth strategy of Bitmap is not > good: we will be repallocing byte by byte. True, that repallocing seems bad. You could force it to be pre-allocated by setting the last bit. Or add a function to explicitly enlarge the bitmap. - Heikki