pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: blamario@protonmail.com
Subject: BUG #18525: Boolean aggregate functions like EVERY/BOOL_AND should shortcut
Date: Fri, 28 Jun 2024 07:14:21 +0000
Message-ID: <18525-b36c2e34bde50082@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      18525
Logged by:          Mario
Email address:      blamario@protonmail.com
PostgreSQL version: 13.10
Operating system:   Linux
Description:        

This is a feature request, not a bug strictly speaking. I'm working with a
query of the form

```
SELECT
  EVERY (field1 IS NULL) AS field1,
  EVERY (field2 IS NULL) AS field2,
  ...
  EVERY (field255 IS NULL) AS field255
FROM large_table
```

The goal is to establish if there are any columns that are always NULL, and
if so which ones. I was hoping that the EVERY aggregate functions would
_shortcut_ the aggregate as soon as a non-null value was encountered, and
furthermore that the SELECT statement would stop searching once all results
are established to be false. That's not happening: PostgreSQL takes two
hours to search through the entire long table, returning all false.



view thread (2+ messages)  latest in thread

Message-ID: <18525-b36c2e34bde50082@postgresql.org>
Permalink:  ../18525-b36c2e34bde50082@postgresql.org/
Also on:    postgresql.org/message-id/18525-b36c2e34bde50082@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, blamario@protonmail.com
  Subject: Re: BUG #18525: Boolean aggregate functions like EVERY/BOOL_AND should shortcut
  In-Reply-To: <18525-b36c2e34bde50082@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox