- Shared Lock (S): Placed during read operations (
SELECT). Multiple transactions can hold shared locks concurrently, but writes are blocked. - Exclusive Lock (X): Placed during write operations (
INSERT,UPDATE,DELETE). Blocks all other concurrent reads and writes.
SQL Performance Tuning & Indexing Strategies
Cards in this deck
(20 cards)Preview terms and definitions before starting your study session.
- Pessimistic: Locks resources aggressively upfront assuming conflicts will happen; best for high-contention write workloads.
- Optimistic: Uses row versioning/timestamps without upfront locks; validates changes at commit time and rolls back on conflicts. Ideal for high-concurrency read-heavy workloads.
WHERE condition to index only a specific subset of rows (e.g., CREATE INDEX idx_unprocessed ON jobs(created_at) WHERE status = 'PENDING'). Reduces index size, lowers write maintenance overhead, and speeds up selective queries.OR Conditions to UNION ALLOR across multiple columns often fail to utilize individual indexes efficiently, falling back to full scans. Rewriting as two separate SELECT statements joined by UNION ALL enables separate, optimized index seeks for each predicate.EXISTS vs. INEXISTS short-circuits and returns true as soon as a single match is found in the subquery. IN evaluates the entire subquery result set before filtering and can produce incorrect results or poor plans if the subquery returns NULL values.- Nested Loop: Iterates over outer rows matching inner rows; ideal for small sets and indexed inner lookups ( worst-case).
- Hash Match: Builds an in-memory hash table for large, unsorted datasets.
- Merge Join: Blazingly fast join that requires both input datasets to be pre-sorted on join keys.
Related Flashcard Sets
Explore similar study materials created by the community
TypeScript - Modern JavaScript Development & Type Safety
Master TypeScript's powerful type system, generics, utility types, and configuration to build scalable, type-safe web applications with confidence.
Monash FIT9132 - Data Mining & Machine Learning Fundamentals
Master essential data mining techniques and machine learning algorithms from Monash FIT9132, spanning data preprocessing, classification, clustering, association rules, and evaluation metrics.
Biochemistry - Metabolic Pathways & Regulation
Master central metabolic pathways, bioenergetics, and hormonal regulation with high-yield flashcards designed for biochemistry, medical, and life science exams.
JLPT N2 - Advanced Japanese Grammar, Vocabulary & Kanji
Master upper-intermediate Japanese grammar patterns, high-frequency N2 kanji, and essential vocabulary with this comprehensive JLPT N2 prep deck. Elevate your fluency with detailed usage rules, example sentences, and formal nuances.