Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kN588-0002SJ-8y for pgsql-hackers@arkaria.postgresql.org; Tue, 29 Sep 2020 02:12:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kN587-0001Fr-6Z for pgsql-hackers@arkaria.postgresql.org; Tue, 29 Sep 2020 02:12:35 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kN586-0001Fj-Ri for pgsql-hackers@lists.postgresql.org; Tue, 29 Sep 2020 02:12:34 +0000 Received: from mail-ed1-x542.google.com ([2a00:1450:4864:20::542]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kN584-0004uS-4P for pgsql-hackers@postgresql.org; Tue, 29 Sep 2020 02:12:34 +0000 Received: by mail-ed1-x542.google.com with SMTP id i1so4616276edv.2 for ; Mon, 28 Sep 2020 19:12:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=1dAZB9+iaDyoym9MWLheMv62gIzg3hb8E/xJ2YhGo0I=; b=daoAfOnWQr8r+AjvZSemVj2TjbdVZDqe3pOl6SEYsFObAUc0+TQJvHxuvXY4eSyLMa 5JNXlmB5WQXTMc75EJh2D9Hhsw1bc3GB8S6U1q1lWlTWJoFyiXW5Zxfqm51t+obkIQe2 6Or2Uk1uhb8Hq26QXQNbecVNioqV4Xyutw1tAfjthSz7y5TwsH9k9XfgR49tMQnq+peK RfCsaY2SdUrb8cIF0y5gkir99xArO7Oig63U10r2IqVmD35jIYoUU4o4D0DA38xnOvwP MRAtw9H29ixzgl/drdc5noTyaIfqjJO/xCftpXc/3Tvze+ukJhKPQdSHYGJzAI+tBDuX LOHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=1dAZB9+iaDyoym9MWLheMv62gIzg3hb8E/xJ2YhGo0I=; b=tqLLWVDx3l81QFQAERT47Ew9gAkUgkSAVByE3wCFFI5BhgAHt0pt//5c4mUs/10DIL hLDvRbxS60LM8B3y94qXiJUEZXIX2NV27IkegSI83BDd+gp+u1BXA8l6WT0U8CnkyoC2 DOtUDdeQLWPK/16zixnrJXSnxRpBulY8EGXC811SwhNDVcsRZWebVBfh5aNW6UVjunqF GBRMoXNZyMNlrzllruVHz6a0u9bGfM337uqiixCwJVNxX3xmT83XgsglZKkLYgca61qQ /6fPdazHKb++ZBLDb75eok2UqZP1mYmiUOlcK4QB9BZzi0P/b1rceOWJP0j161vmgLV7 NtEA== X-Gm-Message-State: AOAM530BH4X+Q+4fuYdD4I3PNN5wgQPPmKzvIC/1kQqK/Z0xZCCO9k0W dlpoO2P5WREVW4Azg5wlB0/7jQ== X-Google-Smtp-Source: ABdhPJzWyS9yasxWABi9xoMKJLVGSfGWA6KK/YT0CWT4B5EPOi9aP2CQ67DeUXRvbPAaJJUoDAEQjA== X-Received: by 2002:aa7:d353:: with SMTP id m19mr851031edr.275.1601345551239; Mon, 28 Sep 2020 19:12:31 -0700 (PDT) Received: from localhost (ip-86-49-245-76.net.upcbroadband.cz. [86.49.245.76]) by smtp.gmail.com with ESMTPSA id rl14sm3465770ejb.109.2020.09.28.19.12.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 19:12:30 -0700 (PDT) Date: Tue, 29 Sep 2020 04:12:28 +0200 From: Tomas Vondra To: John Naylor Cc: Alvaro Herrera , pgsql-hackers Subject: Re: WIP: BRIN multi-range indexes Message-ID: <20200929021228.bf2vtpl3negue4y4@development> References: <20200918114014.sz5a3nwt7zont4rz@development> <20200918222702.omsieaphfj3ctqg3@development> <20200921195607.gt6xbia7v55bhuwq@development> <20200924235045.bgxsilvf7askukph@development> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Mon, Sep 28, 2020 at 04:42:39PM -0400, John Naylor wrote: >On Thu, Sep 24, 2020 at 7:50 PM Tomas Vondra > wrote: >> >> On Thu, Sep 24, 2020 at 05:18:03PM -0400, John Naylor wrote: > >> >Hmm, how ugly would it be to change the default range size depending >> >on the opclass? >> > >> >> Not sure. What would happen for multi-column BRIN indexes with different >> opclasses? > >Sounds like a can of worms. In any case I suspect if there is no more >graceful way to handle too-large filters than ERROR out the first time >trying to write to the index, this feature might meet some resistance. >Not sure what to suggest, though. > Is it actually all that different from the existing BRIN indexes? Consider this example: create table x (a text, b text, c text); create index on x using brin (a,b,c); create or replace function random_str(p_len int) returns text as $$ select string_agg(x, '') from (select chr(1 + (254 * random())::int ) as x from generate_series(1,$1)) foo; $$ language sql; test=# insert into x select random_str(1000), random_str(1000), random_str(1000); ERROR: index row size 9056 exceeds maximum 8152 for index "x_a_b_c_idx" I'm a bit puzzled, though, because both of these things seem to work: 1) insert before creating the index create table x (a text, b text, c text); insert into x select random_str(1000), random_str(1000), random_str(1000); create index on x using brin (a,b,c); -- and there actually is a non-empty summary with real data select * from brin_page_items(get_raw_page('x_a_b_c_idx', 2), 'x_a_b_c_idx'::regclass); 2) insert "small" row before inserting the over-sized one create table x (a text, b text, c text); insert into x select random_str(10), random_str(10), random_str(10); insert into x select random_str(1000), random_str(1000), random_str(1000); create index on x using brin (a,b,c); -- and there actually is a non-empty summary with the "big" values select * from brin_page_items(get_raw_page('x_a_b_c_idx', 2), 'x_a_b_c_idx'::regclass); I find this somewhat strange - how come we don't fail here too? regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services