KiteSQL icon indicating copy to clipboard operation
KiteSQL copied to clipboard

Perf: Downgrade `MDL` to Table Level Locks

Open KKould opened this issue 1 year ago • 0 comments

It's kind of like a hierarchical lock and intention lock, but it is still a table level lock in most case, and multiple ddl on different table can execute concurrently.

session1                                        session2
select * from t;
                                               alter table t2 add column d int(ok)
                                               alter table t add column d int(block)

+-------------+--------------------+----------------+---------------------+
| OBJECT_TYPE | OBJECT_SCHEMA      | OBJECT_NAME    | LOCK_TYPE           |
+-------------+--------------------+----------------+---------------------+
| TABLE       | test               | t              | SHARED_READ         | 
| GLOBAL      | NULL               | NULL           | INTENTION_EXCLUSIVE | 
| BACKUP LOCK | NULL               | NULL           | INTENTION_EXCLUSIVE |
| SCHEMA      | test               | NULL           | INTENTION_EXCLUSIVE |
| TABLE       | test               | t              | SHARED_UPGRADABLE   |
| TABLESPACE  | NULL               | test/t         | INTENTION_EXCLUSIVE |
| TABLE       | test               | #sql-790d_b    | EXCLUSIVE           | 
| TABLE       | test               | t              | EXCLUSIVE           |
| TABLE       | performance_schema | metadata_locks | SHARED_READ         | 
+-------------+--------------------+----------------+---------------------+

I don't think implicitly submiting is a good thing, you can't even rollback(even when you kill it, it is crazy).

Originally posted by @crwen in https://github.com/KipData/FnckSQL/issues/171#issuecomment-2015718905

KKould avatar Mar 25 '24 07:03 KKould