1651
GB
What is the difference between index seek and index scan in query execution plans?
IN
क्वेरी निष्पादन योजनाओं में इंडेक्स सीक और इंडेक्स स्कैन के बीच क्या अंतर है?
A
Index scan is always faster than index seek
इंडेक्स स्कैन हमेशा इंडेक्स सीक से तेज़ होता है
B
Index seek is for range queries; index scan for equality
इंडेक्स सीक रेंज प्रश्नों के लिए है; समानता के लिए सूचकांक स्कैन
C
Index seek: uses the B-tree to navigate directly to the matching key value(s) - O(log n) + matching rows only. Index scan: reads all (or most) leaf pages of the index sequentially - O(index_size). Seek is much faster for selective queries; scan used when large fraction of data is returned or index cannot be used for point lookup
इंडेक्स सीक: मिलान कुंजी मान (मानों) - ओ (लॉग एन) + केवल मिलान पंक्तियों पर सीधे नेविगेट करने के लिए बी-ट्री का उपयोग करता है। इंडेक्स स्कैन: इंडेक्स के सभी (या अधिकांश) लीफ पेजों को क्रमिक रूप से पढ़ता है - O(index_size)। चयनात्मक प्रश्नों के लिए सीक बहुत तेज़ है; स्कैन का उपयोग तब किया जाता है जब डेटा का बड़ा हिस्सा लौटाया जाता है या पॉइंट लुकअप के लिए इंडेक्स का उपयोग नहीं किया जा सकता है
D
Index seek is for non-indexed columns; index scan for indexed
इंडेक्स सीक गैर-अनुक्रमित कॉलम के लिए है; अनुक्रमित के लिए सूचकांक स्कैन
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English)
Seek: optimizer has a selective predicate (WHERE id=42) -> traverse B-tree from root to leaf O(log n). Fast for selective queries. Scan: predicate is not very selective or no matching index -> read all leaf pages sequentially. For covering index scans, scanning may still be efficient if sequential I/O.
व्याख्या (हिन्दी)
खोजें: ऑप्टिमाइज़र के पास एक चयनात्मक विधेय है (जहां आईडी = 42) -> बी-ट्री को जड़ से पत्ती ओ (लॉग एन) तक पार करें। चयनात्मक प्रश्नों के लिए तेज़. स्कैन: विधेय बहुत चयनात्मक नहीं है या कोई मिलान सूचकांक नहीं है -> सभी पत्ती पृष्ठों को क्रमिक रूप से पढ़ें। इंडेक्स स्कैन को कवर करने के लिए, अनुक्रमिक I/O होने पर स्कैनिंग अभी भी कुशल हो सकती है।