Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1j85K0-0000LV-Hc for pgsql-sql@arkaria.postgresql.org; Sat, 29 Feb 2020 16:50:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j85Jx-0006Hy-O6 for pgsql-sql@arkaria.postgresql.org; Sat, 29 Feb 2020 16:50:33 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j85Jx-0006Hr-Av for pgsql-sql@lists.postgresql.org; Sat, 29 Feb 2020 16:50:33 +0000 Received: from li1929-156.members.linode.com ([172.104.219.156] helo=ln-1.useunix.net) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j85Jq-0002oD-8V for pgsql-sql@lists.postgresql.org; Sat, 29 Feb 2020 16:50:31 +0000 Received: from wcuddy by ln-1.useunix.net with local (Exim 4.92.3) (envelope-from ) id 1j85Jo-0008K0-Uh for pgsql-sql@lists.postgresql.org; Sat, 29 Feb 2020 16:50:24 +0000 Date: Sat, 29 Feb 2020 16:50:24 +0000 From: Wayne To: pgsql-sql@lists.postgresql.org Subject: min()/max() with BRIN indexes Message-ID: <20200229165024.GD20190@ln-1.useunix.net> Mail-Followup-To: pgsql-sql@lists.postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I have rather large tables that use a time stamp as an index. New entries are continuously added to the table with the current time. If I convert from BTREE to BRIN indexes and select records with specific date ranges the BRIN is used and performance is acceptable. However I often want to get the latest time stamp using the max() function. I didn't expect that this would result in a sequential scan of the table and skip the BRIN index. Is this expected behavior? Thanks, Wayne