SQL Server : are transaction locking table for other users?

后端 未结 2 830
既然无缘
既然无缘 2021-01-27 23:41

Does a transaction lock my table when I\'m running multiple queries?

Example: if another user will try to send data in same time which I use transaction, what will happe

2条回答
  •  庸人自扰
    2021-01-28 00:36

    You cannot avoid that multiples users load data to the database. It is neither feasible nor clever to lock every time a single user requested the usage of a table. Actually you do not have to worry about it, because the DB itself will provide mechanism to avoid such issues. I would recommend you reading into ACID properties.

    • Atomicity
    • Consistency
    • Isolation
    • Durability

    What may happen is that you could suffer a ghost read, which basically consist that you cannot read data unless the user who is inserting data commits. And even if you have finished inserting data and do not commit, there is a fair chance that you will not see the changes.

    DDL operations such as creation, removal, etc. are themselves committed at the end. However DML operation, such as update, insert, delete, etc. are not committed at the end.

提交回复
热议问题