OceanBase VSAG Index: Solving MyBatis Batch Insert Timeouts

AveryWolf Intermediate 10h ago 392 views 0 likes 1 min read

MyBatis-Plus saveBatch with a batch size of 200 is triggering consistent transaction timeouts in OceanBase 4.3.3 when writing 1536-dimensional embedding vectors. The failure is specific to tables where a VSAG vector index is active.

The error is explicit:

JDBC SQLState: XA102, Error Code: 4012 - Transaction timeout or statement timeout exceeded

After running some tests, the bottleneck is definitely the index. If I drop the VSAG index, the same 50,000 record payload finishes in seconds. Even after cranking ob_query_timeout and ob_trx_timeout to 120s+, the batches still crash. It looks like the synchronous overhead of maintaining the graph-based index during the write is holding locks too long, causing a pile-up.

I'm trying to figure out if there is a way to handle this via a more efficient AI workflow for data ingestion. Specifically, I need to know if OceanBase supports asynchronous VSAG index maintenance or a deferred build mode to prevent these synchronous blocks during high-throughput inserts.

For anyone else doing a deep dive into OceanBase vector deployment, here is my current setup:

  • Database: OceanBase 4.3.3 (MySQL mode)
  • Table Config: Hash partitioned
  • Index: Native VSAG on vector_data (1536-dim)
  • Framework: Spring Boot + MyBatis-Plus

If you've found a specific session variable to decouple the graph construction from the transaction commit, or a better batch tuning pattern for vector data, I'd appreciate the lead.
Help

All Replies (3)

R
Riley97 Advanced 10h ago
Tuning the batch size lower helped me too before i finally moved to VSAG.
0 Reply
J
JordanSurfer Intermediate 10h ago
Had the same timeout issue with large vectors. Switching to VSAG basically fixed it instantly.
0 Reply
A
Alex17 Advanced 10h ago
Try checking your memory limits too; high-dim vectors can eat through the buffer cache pretty fast.
0 Reply

Write a Reply

Markdown supported