A mechanism for managing concurrent access to shared data or resources by granting temporarily exclusive access to the processes requesting the lock.

learn more… | top users | synonyms (1)

1
vote
0answers
27 views

Row locks on selects

select t.*, row_number() over ( partition by t.Entity_Identifier order by t.Message_Sequence ) as seqnum from Process_Activity t (ROWLOCK) where t.Process_Id = Is it possible for ...
-2
votes
0answers
14 views

Scavenger hunt on quest for knowledge led me to SST table keys hash failure and databases [on hold]

My adventure started with a bootloader that would not re-Lock on my friends nexus 6. Through my investigating and research I think that the issue may be at a deeper level into the code. My original ...
3
votes
1answer
43 views

Locking in Postgres for UPDATE / INSERT combination

I have two tables. One is a log table; another contains, essentially, coupon codes that can only be used once. The user needs to be able to redeem a coupon, which will insert a row into the log table ...
0
votes
1answer
23 views

MySql Lock Tables Blocking Logic

The MySQL documentation (5.5) for Lock tables states: Let's say that I'm trying to lock table1 and table2 in a single query, but table2 is already locked. Will MySQL hold onto a lock on table1 and ...
2
votes
2answers
54 views

Locking issues under transaction on Postgres

I recently got a "Out of shared memory - You might need to increase max_locks_per_transaction" error. This is a long running process where I import a bunch of CSV files after proper processing. I ...
1
vote
0answers
48 views

Why are SELECT queries in sleeping status holding open transactions

Using sp_WhoIsActive, I see that I have a lot of processes in a "sleeping" status, several for hours. I am not sure of the cause and am still troubleshooting (timeout? bad code with uncommitted ...
0
votes
0answers
68 views

MySQL queries waiting for table lock

Today I had some weird behaviour on my MySQL server that I couldn't explain. Hopefully someone can give me some debugging hints. The initial problem was that some parts of our webshop didn't seem to ...
1
vote
1answer
69 views

INSERT [TableName] SELECT * FROM [TableName]

I just ran across a query: INSERT [TableName] SELECT * FROM [TableName] Note that it is the same table. This query causes serious blocking on one of my test databases (I wanted to drop it but ...
2
votes
0answers
41 views

innodb update with limit locks all matching (ignores limit)

For a query similar to this: UPDATE myinnotable1 SET value=5,updated=now(),status=1 WHERE status>10 AND message="match msg" LIMIT 1; I found that innodb engine locks ALL rows matching criteria ...
2
votes
0answers
51 views

Why does SQL Server 2005 only use an IS lock in this scenario?

I am attempting to examine the locking behind different queries but with the same output to avoid deadlocking situations. I have the following code: SELECT MIN(ID), TextData FROM PKKEYTESTER ...
2
votes
2answers
48 views

Blocked Process Report -two updates causing a long block

I have a .NET application which is getting SQL update timeouts and I believe that some sort of blocking/locking is taking place which is causing this. I have ran a blocking process report on the ...
1
vote
1answer
37 views

Viewing Type Of Lock Being Used T-SQL - Update Lock Query Issue

I am looking for a way to determine whether SQL will take a shared lock or an update lock. Take these three queries. I believe in that in theory: Query one will take a shared lock on the pk, due ...
2
votes
1answer
42 views

Create Database and LCK_M_S

We are experiencing issues when creating a database in the SSMS GUI in that sometimes it times out complaining that it could not get an exclusive lock on the Model database. Other times the database ...
3
votes
0answers
48 views

In Sql Server, is there a way to check if a selected group of rows are locked or not?

We are attempting to update/delete a large number of records in a multi-billion row table. Since this is a popular table, there is a lot of activity in different sections of this table. Any large ...
0
votes
0answers
24 views

Trigger copies history table: Will removing index lock options speed up the process?

I have a trigger applied to a table to write inserts and updates to a history table. That history table can grow pretty fast, and we want to see, if we can speed up insert operation a bit. The values ...
1
vote
1answer
44 views

How does the table scan in an UPDATE WHERE predicated on an unindexed column work?

I was looking into a deadlock caused by two concurrent UPDATE statements: UPDATE [table] SET [column] = 0 WHERE [unindexed_column] = @id My understanding is that because the column the WHERE is ...
5
votes
4answers
155 views

View locks acquired during query execution (SQL Server)

Query execution plan does not show the locking details by default, is it possible to view the locks, along with the type, acquired during the execution of a query?
3
votes
2answers
263 views

Performance hickups after Postgres 9.4 upgrade

After upgrading our database from 9.3.5 to 9.4.1 last night, the server suffers from high CPU spikes. The upgrade was done with pg_dump. So the database was converted to SQL and then imported into ...
3
votes
1answer
79 views

Lock in mysql database

My schema 'test' has 3 tables: 'user', 'post' and 'revision'. CREATE TABLE IF NOT EXISTS `test`.`user` ( `iduser` INT UNSIGNED NOT NULL AUTO_INCREMENT, `name` VARCHAR(45) NOT NULL, PRIMARY KEY ...
4
votes
0answers
17 views

Lock in mysql database [duplicate]

My schema 'test' has 3 tables: 'user', 'post' and 'revision'. CREATE TABLE IF NOT EXISTS `test`.`user` ( `iduser` INT UNSIGNED NOT NULL AUTO_INCREMENT, `name` VARCHAR(45) NOT NULL, PRIMARY KEY ...
0
votes
1answer
32 views

How does PostgreSQL decide which query to cancel during deadlock cleanup

I know that PostgreSQL will detect and clear deadlock once it happen by cancelling one of the queries. How does PostgreSQL decide which one to cancel? Is this deterministic or there is some randomness ...
0
votes
1answer
74 views

Rolling update to all rows in innodb table (no rollback if aborted)

I have the following table, which stores the Social Security Death Master File database (~86M rows): CREATE TABLE `death_master_files` ( `id` int(11) NOT NULL AUTO_INCREMENT, `ssn_an` smallint(5) ...
2
votes
1answer
39 views

Implications of setting READ_Write

I am looking to update several users on READ_ONLY databases. As the databases are used 24/7 globally, and maintenance windows have just past, I would like to do this during a low-activity moment (to ...
0
votes
1answer
24 views

I have a DB that is locking up from numerous updates to a table: Should I convert it from MyISAM to InnoDB?

FYI: I don't believe this is a duplicate question, I've looked and most are general questions with vague answers. See more specifics below: Currently a database I am in charge of locks up every once ...
0
votes
0answers
52 views

Postgresql: Update or insert stuck

I'm running update-or-insert query on a table of approximatelly 3mln rows, 4 columns. Query is part of every day process, and for same days, the query stucks forever. It's just blocked. It's ...
2
votes
2answers
109 views

mysql write lock

I dont add any manual locking or any transaction anything, just manual running queries from php script, and execute below two update queries at the same time update table_x set status = 'PROCESSING' ...
1
vote
1answer
56 views

Deadlock scenario, where is this S lock coming from?

I am encountering the below deadlock scenario. Please see the attached object definitions and execution plans. The plans were pulled out of cache from a system where this deadlock does occur. I ...
3
votes
1answer
131 views

How to perform server-side transaction timeout if COMMIT TRANSACTION will never arrive?

How can SQL Server terminate one of its transactions if it exceeds preset timeout? Imagine the following transaction performed by traveling salesman's SQL client application, which is submitted ...
0
votes
1answer
209 views

MySQL: SELECT GET_LOCK slow/timeout

I am using "Zebra Session" as a replacement for PHP's built-in session management. Zebra Session stores sessions in a MySQL database, and uses "session locking" in order to ensure that data is ...
1
vote
1answer
115 views

SELECT RELEASE_LOCK causing “Mysql has gone away”

During a long running process (90m+), our code calls SELECT RELEASE_LOCK('..');. However it always gives a "Mysql has gone away" error when we do this. We have tried a number of things including ...
3
votes
1answer
139 views

Work queue with complex select and long processing: Ensuring concurrency

I have a queue table from which worker processes claim records, one at a time. It is crucial that no two workers claim same item to process. Normally this kind of thing is done with select top (1) ...
2
votes
0answers
44 views

SQL Server 2008 R2 - Should I be worried at this statistics regarding indices causing locks?

We have some mild table locking issue during our peak hours so I figured the following query query taken from this site would be a good start. And boy, does it show me some seriously concerning ...
1
vote
2answers
200 views

Is it safe to cancel a PostgreSQL ALTER TABLE query that is waiting on a lock?

We started an ALTER TABLE query hours ago and only recently realized (via pg_stat_activity) that it is waiting on a lock. We discovered the other query that is holding a lock on the table we want to ...
3
votes
0answers
197 views

Slow transactions, many locks

At high load conditions the server app stops responding to client because begin/commit statements are executing very slowly (some take 15 seconds). The queries are simple - insert, update two columns ...
1
vote
1answer
124 views

What happens if two mySQL queries both try to lock the same row at the same time?

So this isn't exactly my strong suit, but here's my basic understanding of the situation: If two threads of the same application both try to execute the same query at the same time, mySQL will ...
0
votes
1answer
197 views

How to update a (very) large table without locking in MySQL

I have a large table (58+ million records) which represents a relation between two records (player and target) in a second table. Unfortunately, whoever designed our schema didn't think things ...
4
votes
0answers
81 views

When does SQL Server acquire locks?

The list of isolation levels in SQL Server found here states that write locks acquired within a transaction are retained until the end of the transaction. However it doesn't mention anything about ...
3
votes
1answer
142 views

(How) does table inheritance interfere with locking in postgres?

I have a table inheritance setup that might be simplified like this: CREATE TABLE p ( id BIGSERIAL PRIMARY KEY, type_id BIGINT, approved BOOLEAN ); CREATE INDEX ON p(approved); CREATE ...
1
vote
0answers
53 views

Average Waiter Count increasing

I am in a nightmare. We have deployed an application to a UAT environment, which has only 7 users. Since then, we have noticed in the logs, a lot of deadlocks, and processes being victims and things. ...
1
vote
2answers
164 views

SQL Server - Slow Database for no apparent reason [closed]

I have a DB Server running SQL Server 2008 R2 SP2 on 24 physical Cores and 32GB of RAM. The database files are on a SSD Raid1 and the TempDB on a SAS 15k (150GB DB) I assume that the server has more ...
3
votes
1answer
95 views

enabling snapshot isolation level on a database - what to monitor?

I am having problems with frequent deadlocks on a subscription database. I am considering enabling the snapshot isolation level for that database. I am aware that there is an overhead on the tempDb ...
0
votes
1answer
74 views

GET_LOCK([name], 0) behaviour and multiple GET_LOCK() order

I read from the documentation that the behavior of distributing a lock requested by many connections after RELEASE_LOCK is called from the connection holding the lock is undefined. I was curious: say ...
10
votes
2answers
229 views

SQL Server Index Update Deadlock

I have 2 queries which when run at the same time are causing a deadlock. Query 1 - update a column which is included in an index (index1): update table1 set column1 = value1 where id = @Id Takes ...
0
votes
2answers
192 views

Determine whether there is any blocking while deleting large number of records [closed]

I would like to know whether there is any way to determine why it is taking too much time say 3 minutes for deleting 50K records from a database hosted in Sql Azure. I have clustered index on primary ...
0
votes
1answer
185 views

Concurrent SELECT and UPDATE in multiprocessing python

I have to randomly match about 20 million rows in two tables without using the same row twice using PostgreSQL 9.3.5. Both tables have the following structure CREATE TABLE de_sim_points_end ( -- ...
1
vote
2answers
1k views

When is it safe to disable InnoDB doublewrite buffering?

MySQL InnoDB allows us to disable doublewrite buffering by setting innodb_doublewrite = 0. Other databases doesn't seem to allow this setting to be tweaked. How could InnoDB still be able to maintain ...
0
votes
0answers
563 views

Many transactions are getting stuck in the “cleaning up” state - what could cause that?

I'm trying to track down a locking issue, and found via SHOW PROCESSLIST that when the queries in question are waiting for locks and timing out, there are no other queries active in the process list. ...
5
votes
1answer
667 views

SELECT INTO OUTFILE vs INSERT INTO … SELECT

During my cursory research I have not been able to find a definitive answer on the benefits that SELECT INTO OUTFILE provides over INSERT INTO ... SELECT. Upon reading the docs related to INSERT INTO ...
0
votes
2answers
160 views

Alter table statement waiting (for hours, on dev machine), but no locks shown

I have been trying to issue a simple: ALTER TABLE tablename ADD COLUMN id_col character varying (30) type statement on a Postgres 9.1.13 build on Debian. The application is still in private beta, so ...
0
votes
1answer
148 views

Sybase ASE lock table to disallow users insert values

I need to disallow users to insert values in some table, for example for a 5 mins. Seems I should use at isolation clause but can't figure out how to use it. Thanks