components-contrib icon indicating copy to clipboard operation
components-contrib copied to clipboard

feat(oracle): use TABLE(:bind_array) for bulk get chunks >= 900 keys

Open D2758695161 opened this issue 7 months ago • 1 comments

Summary

Implements the optimization described in dapr/components-contrib#4041.

What changed

In ulkGetChunk, when the number of keys is >= 900, the query now uses Oracle's TABLE(:bind_array) syntax instead of the standard IN (:1, :2, ...) syntax:

\\sql SELECT key, value, binary_yn, etag, expiration_time FROM state_table WHERE key IN (SELECT COLUMN_VALUE FROM TABLE(:1)) \\

This passes goora.StringArray(keys) as a bind variable, leveraging the go_ora driver's native Oracle ARRAY support.

Threshold

  • < 900 keys: standard IN-list with individual bind variables (existing behavior)
  • >= 900 keys: TABLE(:bind_array) with StringArray bind (new optimization)

The 900-key threshold leaves a safe margin below Oracle's 1000-expression hard limit.

Testing

Existing unit tests cover chunking behavior and edge cases. The existing mock-based tests should continue to pass as the logic path is determined at runtime based on key count.

Closes #4041

D2758695161 avatar Apr 23 '26 19:04 D2758695161

This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

dapr-bot avatar Jun 21 '26 09:06 dapr-bot

This pull request has been automatically closed because it was marked stale with no further activity for 7 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

dapr-bot avatar Jun 28 '26 09:06 dapr-bot