fix: Chunk IN clause to <1000 items for oracle compatibility - #2713
Conversation
| } | ||
|
|
||
| $allRows = []; | ||
| foreach (array_chunk($rowIds, 997) as $rowIdChunk) { |
There was a problem hiding this comment.
Doubtful about this hardcoded number. The query consumes two arrays. ColumnId is unlikely to have more than 1k entries, but definitely more than 3. So should be 1k - count($columnIds). Then I am not sure how Oracle treats the join, but reducing the other 2 seems safe then: 1k - count($columnIds) -2.
The bad thing is that the -2 cannot be computed from here, as it is a detail of the called method.
There was a problem hiding this comment.
I think the triggered query has 2 INs while each can have up to 1K items, so we could probably chunk by 1000 if you like. The columns are not relevant for chunking as you said and currently not chunked, just the row IDs, no?
Else if unsure about how Oracle treats multiple INs in a query and if all of them need to be max 1k in total than we could follow your approach of 1k - count($columnIds) -2
https://stackoverflow.com/questions/2401066/oracle-sql-how-to-use-more-than-1000-items-inside-an-in-clause suggests that many INS are fine as long each is max 1K items.
There was a problem hiding this comment.
They are passed here:
Lines 237 to 238 in f79864d
IIRC the 1k is a global threshold for the query. But I might mix it up with another DB. Quick search shows a global limit of 32767 arguments in Postgres, while Oracle should have the 1k limit per IN clause.
There was a problem hiding this comment.
Updated the info based on your updated fix via b37f358
Assisted-by: Claude Code:claude-sonnet-4-6 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
f79864d to
84caa49
Compare
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Assisted-by: Claude Code:claude-sonnet-4-6 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
20be00e to
b37f358
Compare
Assisted-by: Claude Code:claude-sonnet-4-6
馃弫 Checklist
/backport to stableX.X馃 AI (if applicable)