#2995·grocy

Feature Request: Possible performance improvement related to recipes on SQLite 3.53+

Author: valadasCreated Sep 27, 2026Updated Sep 27, 2026
Labelsenhancement

Problem

SQLite 3.53.0 specifically changed UNION to always use a sort-and-merge algorithm: https://sqlite.org/releaselog/3_53_0.html (see point 7.a

This causes a performance issue for grocy in recipes_pos_resolved which makes loading the recipes or meal plan screens 50 times slower than it should.

Solution

Change UNION to UNION ALL in recipes_pos_resolved

Testing

On SQLite 3.53.4 (before/after):

recipes_pos_resolved: 6.364s -> 0.129s
recipes_resolved:    15.651s -> 0.305s

Easy independent test:

  • run SELECT * FROM recipes_pos_resolved
  • Change only UNION to UNION ALL
  • Rerun it
  • Sort and compare the complete rows including duplicates
  • Results are identical on SQLite 3.45.3 and 3.53.4 making this an easy performance fix without being a breaking change.

I did my best to avoid having a wall of AI stuff, this is as simple as I can make it. It is a one-line-change that would not be breaking. This is not suggesting older supported versions are invalid; only that testing solely on much older SQLite versions can hide regressions that downstream installations encounter once their runtime updates. https://github.com/grocy/grocy/commit/68bd83e104d6348c677c70609ee49eb1cc7d31ab#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5L53 explicitly changed the supported/recommended SQLite version from from 3.34.0+ to 3.40+ so testing and fixing regression issues on 3.x.x should be a valid issue for a one-line bugfix.

@berrnd please consider not dismissing this, it is a one-line thing that is non-breaking. Yes I did use AI to get there but it is a valid bugfix validated by a human. I love this project and I am only trying to help others, not begging for a massive time investment on your part or begging for new crazy features or reporting a mysterious hard to reproduce bug. If this is accepted/fixed, I'll resubmit the other 2 performance improvements in a more easy-to-process way like this one. Crossing fingers.