# Ecto postgres database simultaneous update

**URL:** <https://forum.elixirforum.com/t/ecto-postgres-database-simultaneous-update/31848>\
**Category:** Questions\
**Tags:** ecto\
**Created:** [May 27, 2020, 6:49am UTC](https://forum.elixirforum.com/t/ecto-postgres-database-simultaneous-update/31848 "2020-05-27T06:49:40Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![hauleth](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/hauleth/32/18942_2.png) [@hauleth](https://forum.elixirforum.com/u/hauleth)\
**Post date:** [May 27, 2020, 2:49pm UTC](https://forum.elixirforum.com/t/ecto-postgres-database-simultaneous-update/31848/6 "2020-05-27T14:49:16Z")

</div>

Yes, each query is transaction within itself, so within single query it is impossible to have race condition (assuming that there are no bugs in DB implementation). I would say that DB is probably better optimised for single `UPDATE` queries than locking mechanisms as second one can impose some additional restrictions as DB do not know what you want to do with that lock.

---

_[View the full topic](https://forum.elixirforum.com/t/ecto-postgres-database-simultaneous-update/31848)._
