SQLite Forum

Performance regression min/max in 3.33.0?
Login
Hello, I have the following query that would execute almost instantly for
various datasets (primarily using sqlite 3.28.0 on MacOS). But when switching
to 3.33.0 or greater there is a very noticeable performance drop when running
this query. Any ideas?

```
SELECT events.timestamp
FROM events
WHERE events.id IN (
  SELECT MIN(events.id) id
  FROM events
  INNER JOIN categories on (events.channel = categories.id)
  WHERE categories.name not in ("Lorem", "Ipsum")
UNION
  SELECT MAX(events.id) id
  FROM events
  INNER JOIN categories on (events.channel = categories.id)
  WHERE categories.name not in ("Lorem", "Ipsum")
);
```

For various reasons, there are no extra indexes on the tables in question.