Skip to content

Conversation

blizzz
Copy link
Member

@blizzz blizzz commented Nov 25, 2024

Summary

The other day I had to analyze SQL queries. And in the log I found entries like:

UPDATE "oc_filecache" SET "mtime" = GREATEST("mtime", $1), "etag" = $2 
WHERE ("storage" = $3) 
    AND ("path_hash" IN ('0123456789abcdef0123456789abcdef', '123456789abcdef0123456789abcdef0', '23456789abcdef0123456789abcdef01', '3456789abcdef0123456789abcdef012', '456789abcdef0123456789abcdef0123', '56789abcdef0123456789abcdef01234', '6789abcdef0123456789abcdef012345', '789abcdef0123456789abcdef0123456')) 

As you see, some parameters where having placeholders (originating from use of prepared statements) while the IN list had not. So it was not possible to simply sum up this query, because it contained differing values.

Checklist

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
@blizzz blizzz added 3. to review Waiting for reviews technical debt feature: database Database related DB labels Nov 25, 2024
@blizzz blizzz added this to the Nextcloud 31 milestone Nov 25, 2024
->set('mtime', $builder->func()->greatest('mtime', $builder->createNamedParameter((int)$time, IQueryBuilder::PARAM_INT)))
->where($builder->expr()->eq('storage', $builder->createNamedParameter($storageId, IQueryBuilder::PARAM_INT)))
->andWhere($builder->expr()->in('path_hash', $hashParams));
->andWhere($builder->expr()->in('path_hash', $builder->createNamedParameter($hashParams, IQueryBuilder::PARAM_STR_ARRAY)));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should then not return $builder->expr()->literal($hash); above.

@blizzz blizzz mentioned this pull request Jan 8, 2025
This was referenced Jan 14, 2025
This was referenced Jan 21, 2025
@blizzz blizzz mentioned this pull request Jan 29, 2025
1 task
@blizzz blizzz modified the milestones: Nextcloud 31, Nextcloud 32 Jan 29, 2025
@blizzz blizzz added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Jun 12, 2025
This was referenced Aug 22, 2025
This was referenced Sep 2, 2025
This was referenced Sep 25, 2025
@skjnldsv skjnldsv modified the milestones: Nextcloud 32, Nextcloud 33 Sep 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2. developing Work in progress feature: database Database related DB technical debt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants