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 1kG51U-0002aX-MR for pgsql-hackers@arkaria.postgresql.org; Wed, 09 Sep 2020 18:40:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kG51T-0003TJ-Fg for pgsql-hackers@arkaria.postgresql.org; Wed, 09 Sep 2020 18:40:47 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kG51T-0003TC-8f for pgsql-hackers@lists.postgresql.org; Wed, 09 Sep 2020 18:40:47 +0000 Received: from mail-qk1-x742.google.com ([2607:f8b0:4864:20::742]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kG51R-0006Lj-0l for pgsql-hackers@postgresql.org; Wed, 09 Sep 2020 18:40:46 +0000 Received: by mail-qk1-x742.google.com with SMTP id q5so3463169qkc.2 for ; Wed, 09 Sep 2020 11:40:44 -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:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=e2lWCr4uLCJBkNH3/WvNcjRA0vG+SnJUDzJNNYvjbis=; b=S4eyYfzpJZdR4Sy6tlHEOufa92K1GsE/JizTuZJviHZoHDkx+onQxWKQ4yPC3f3LhH NkTzSyXfaX2HTEgZSni1WSFbTJ+uSXiI6uyCmrG1gtkWvkLnUu2hevUJTFByzfxSx3zT yPqjIS+JlOQXggJM27TQtr+54xjlmq57vbn8WPadr5RKY49alvptPb0qTpp8krwbiF8S ZN0ekAd+03CKM6kO1dsmjtDlhMdl7wzbaFrCXJHKqizHsZnl/cLefe10vjBiOYk0H+V+ xBgHvFW/XnwN1hYiMQuIUj2V2ApQW8U7bq2zpQaw8sv+AzSbjJQbsjvMJn6t9wFDAj44 r3bw== 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:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=e2lWCr4uLCJBkNH3/WvNcjRA0vG+SnJUDzJNNYvjbis=; b=oYuS8pReBd2xNw+OgXHO6jBGf6sb/hQS0BxLDXjruC/o6PeGPV4D8UWHfmltWzN38e 0F/3jnqYyDfNmJ0x5Nn+9ffj0Mof1b8DEudd0VE+xrc1GQxXvjG01HGCswPAabM+d9na q/7B9FxxlHBqzpA7RpKcFmKTFD0KAfPHeCfBfhMBU5zexnQDsadZ7vSRvaBGTMdYhgbn KaZtcvNCpjNs2jikSKUOaisOtNDaw6aTj+Z3KtiRsszLe+34iM6/P6jRfB6tiA3t03BC qwQ3WH6qXiD8sO4a3g13uo+8TJqZc7Phx4L3Qvp/n00YFW1c1xK/jo+6zmcVhfV/ltuO T8xQ== X-Gm-Message-State: AOAM530MT4142i0oS8IwY4xLjiQcaYig5E46TDxWpr7n6in8tyOi/Zkq 2aYwrdMCyu/5z7DwvI1XuiIYvw== X-Google-Smtp-Source: ABdhPJxfhcoUOw1fcLKnTKEe8dUmF0thueDsinIB2feNzSdESsOE7M17FynAazVGI4OYcECkCjOzwQ== X-Received: by 2002:a37:a7cb:: with SMTP id q194mr4513225qke.183.1599676844001; Wed, 09 Sep 2020 11:40:44 -0700 (PDT) Received: from perhan.alvh.no-ip.org ([190.95.19.47]) by smtp.gmail.com with ESMTPSA id i66sm3434153qkc.63.2020.09.09.11.40.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Sep 2020 11:40:43 -0700 (PDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id C89C42A1997; Wed, 9 Sep 2020 15:40:41 -0300 (-03) Date: Wed, 9 Sep 2020 15:40:41 -0300 From: Alvaro Herrera To: John Naylor Cc: Tomas Vondra , pgsql-hackers Subject: Re: WIP: BRIN multi-range indexes Message-ID: <20200909184041.GA3829@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-Sep-09, John Naylor wrote: > create index on t using brin (a); > CREATE INDEX > Time: 1631.452 ms (00:01.631) > create index on t using brin (a int8_minmax_multi_ops); > CREATE INDEX > Time: 6521.026 ms (00:06.521) It seems strange that the multi-minmax index takes so much longer to build. I wonder if there's some obvious part of the algorithm that can be improved? > The second thing is, with parallel seq scan, the query is faster than > a BRIN bitmap scan, with this pathological data distribution, but the > planner won't choose it unless forced to: > > set enable_bitmapscan = 'off'; > explain analyze select * from t > where a between 1923300::int and 1923600::int; This is probably explained by the fact that you likely have the whole table in shared buffers, or at least in OS cache. I'm not sure if the costing should necessarily account for this. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services