Title: When does database commit?
Last modified: August 19, 2016

---

# When does database commit?

 *  [srp0uk](https://wordpress.org/support/users/srp0uk/)
 * (@srp0uk)
 * [18 years, 4 months ago](https://wordpress.org/support/topic/when-does-database-commit/)
 * Hi,
 * when does the wordpress database commit? Is it instant, or is it and the end 
   of the loop?
 * I ask this because I have a plugin that calls the same function twice, and on
   the first run it inserts something to a table, and on the second run it needs
   to check that whatever was inserted…
 * I am thinking that the function won’t work like this unless I manually commit
   after the first run…am I right?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [18 years, 4 months ago](https://wordpress.org/support/topic/when-does-database-commit/#post-687817)
 * Nah, you most likely won’t need to manually commit unless you’re doing something
   really complex.
 * WordPress closes the connection to the database after every hit to the site, 
   so that will commit if commit has not taken place manually.
 *  Thread Starter [srp0uk](https://wordpress.org/support/users/srp0uk/)
 * (@srp0uk)
 * [18 years, 4 months ago](https://wordpress.org/support/topic/when-does-database-commit/#post-687838)
 * Hmm, ok, thanks for the prompt reply.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘When does database commit?’ is closed to new replies.

## Tags

 * [commit](https://wordpress.org/support/topic-tag/commit/)
 * [database](https://wordpress.org/support/topic-tag/database/)

 * 2 replies
 * 2 participants
 * Last reply from: [srp0uk](https://wordpress.org/support/users/srp0uk/)
 * Last activity: [18 years, 4 months ago](https://wordpress.org/support/topic/when-does-database-commit/#post-687838)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
