Questions tagged [table-locking]

104 questions
5
votes
1 answer

Lock Table with exclusive in H2 database

I am having trouble to convert Oracle syntax to H2 syntax: For example (Oracle): LOCK TABLE CAR_CHIP_ID_LOCK IN EXCLUSIVE MODE In H2 it results in a (syntax error) How do I change the oracle grammar to h2? I have tried Lock_mode but it doesnt…
logger
  • 1,983
  • 5
  • 31
  • 57
5
votes
2 answers

Why doesn't LOCK TABLES [table] WRITE prevent table reads?

According to http://dev.mysql.com/doc/refman/5.0/en/lock-tables.html if I lock a table for writing in mysql, no-one else should have access until it's unlocked. I wrote this script, loaded either as script.php or script.php?l=1 depending on what you…
Ben Holness
  • 2,457
  • 3
  • 28
  • 49
4
votes
2 answers

Multiple Update statements on a single row at exactly same time

I've a scenario where I get a cab request from a customer and I send pickup request to multiple drivers. Now Imagine if two of the drivers who got the request hit the "Accept" button at the exact same time, then which driver will get the ride. I've…
Deepak Singh
  • 610
  • 1
  • 7
  • 23
4
votes
1 answer

Difference between table and row locks

I'm studying about MySQL and how it works, and something confuses me and I don't find any clear explanation on the web about this. What exactly is the difference between row and table locks? One locks the row and the other locks the table. Correct?…
Jonez
  • 55
  • 1
  • 7
3
votes
1 answer

Mysql 8 metadata locks on foreign key tables during alter

When I do alter table commands Im getting lots of dead locks. Where commands are waiting for metadata lock on tables that are not part of the alter table statement. The tables are linked through a foreign key but we are not changing the foreign…
Stephen
  • 4,228
  • 4
  • 29
  • 40
3
votes
2 answers

Innodb Transaction or tables lock?

I have a simple table which is an email queue. CREATE TABLE `emails_queue_batch` ( `eq_log_id` int(11) NOT NULL DEFAULT '0', `eq_to` varchar(120) CHARACTER SET utf8 DEFAULT NULL, `eq_bcc` varchar(80) CHARACTER SET utf8 DEFAULT '', `eq_from`…
Nir
  • 24,619
  • 25
  • 81
  • 117
3
votes
1 answer

PHP Mysql PDO and unlock table

Should I manage the table unlock in case of an error in php (try/catch)? Or the lock is automatically released by PDO object ad the end of the script?
Tobia
  • 9,165
  • 28
  • 114
  • 219
3
votes
1 answer

Do MySQL Locked Tables affect related Views?

So after reading Performance in PDO / PHP / MySQL: transaction versus direct execution in regards to performance issues I was thinking about I did some research on locking tables in MySQL. On…
CogitoErgoSum
  • 2,879
  • 5
  • 32
  • 45
3
votes
1 answer

Hibernate with MS SQL Server 2012 issue with table locks and parallel query

I have a java thread that does the update of few tables in a transaction and there is another thread that reads the tables with read only transaction . The thread that reads the tables is waiting and not retuning the result and returns only after…
tanmally
  • 996
  • 1
  • 9
  • 13
3
votes
3 answers

How can I get SQL Server transactions to use record-level locks?

We have an application that was originally written as a desktop app, lo these many years ago. It starts a transaction whenever you open an edit screen, and commits if you click OK, or rolls back if you click Cancel. This worked okay for a desktop…
Joe White
  • 94,807
  • 60
  • 220
  • 330
3
votes
1 answer

MySQL InnoDB table locking inside stored procedure

I wonder why MySQL does not allow table locking inside a stored procedure. I have the following SQL statements inside my stored procedure: -- Total amount of money for comments start transaction; select @num_comments := count(*) from `comment`…
Agent Coop
  • 392
  • 4
  • 12
2
votes
1 answer

SQL Server 2008 stored proc running concurrently causing delays

I have a problem where it seems that when running the same stored procedure at the same time from two different instances of the same application it is timing out, and wondered if there was anything I could do to resolve it? I believe the problem…
2
votes
4 answers

MySQL select with a count query on another table

I have simple article application with three tables: article id, title, body, user_id comment id, article_id, user_id, body user id, username On the landing page, I want to show the latest article titles with the author name and total…
usef_ksa
  • 1,669
  • 3
  • 23
  • 40
2
votes
1 answer

Oracle Data Pump Export (expdp) locks table (or something similar)

I must export data from a partitioned table with global index that must be online all the time, but I am having troubles in doing that. For data export I am using Data Pump Export - expdp and I am exporting only one partition. The oldest one, not…
Ivica
  • 63
  • 1
  • 2
  • 5
2
votes
0 answers

Locking of tables in MySQL seems that they aren't able to handle the parallel request?

I locked the table using FOR UPDATE with an IF validation. However, it seems that they aren't able to handle the parallel request? I have two samples of stored procedures. I tested these using cURL to make a parallel requests. DROP PROCEDURE IF…