LemmyNet / lemmy

🐀 A link aggregator and forum for the fediverse
https://join-lemmy.org
GNU Affero General Public License v3.0
13.25k stars 880 forks source link

Fix postgres connection options causing slow query speed. #5150

Closed dessalines closed 2 days ago

dessalines commented 1 week ago

This fixes a query speed issue introduced by 78702b59fd56f767f3d5612bfd60e294979f91f8

This fixes one slow query problem by

Context: #5149

dessalines commented 1 week ago

@dullbananas when you get a chance, could you help me look at this CI error? We only get it when running on the CI, running either db_perf or cargo test locally doesn't have this issue.

It has to do with moving the options to the connection URI, rather than running them before every query.

Database migrations complete.
Error: Error occurred while creating a new object: database "lemmy&options=-c geqo_threshold=12 -c lemmy.protocol_and_hostna" does not exist

https://woodpecker.join-lemmy.org/repos/129/pipeline/9827/16#L243

dullbananas commented 1 week ago

You probably need to make it correctly choose between ? and & based on whether or not the URI already has ?

dessalines commented 6 days ago

@dullbananas That did it, thx!