Batch Transaction in Yugabyte


If have a batch transaction of multiple insert statements, and the last one failed, will it revert the entire transaction.


  • there are 50 nodes and below script will insert 3 different tablet leaders
  • from documentation, my understanding is that it will split into 3 separate insert statement and send to the tablet leaders

(1) if the tablet leaders for "3, ‘monkey’, ‘thrush’) is down, what will the client get back as a response?
(2) Same question as (1), but if the raft_heartbeat_interval_ms = 1000 and leader_failure_max_missed_heartbeat_periods = 5, will that client get back as a response?
(2.a) will client get failure / timeout

Sample Insert (from’s documentation)

INSERT INTO sample(id, c1, c2)
 VALUES (1, 'cat'    , 'sparrow'), (2, 'dog', 'blackbird'), (3, 'monkey' , 'thrush');


Hi @tyuengithub

Assuming you’re taking examples from here INSERT statement [YSQL] | YugabyteDB Docs

Yes, it will be transactional.

If you’re directly connecting to this server that is down (say, using a smart client), then the connection will be closed.

If you’re connected to another server, then you will be able to send the query but the write won’t happen, you’ll get failure.

At 5 heartbeats, the db will still again try to contact the leader, but will timeout. After the 6th heartbeat, a new leader will start to be elected.