[{"data":1,"prerenderedAt":111},["ShallowReactive",2],{"term-i":3,"related-i":96},{"id":4,"title":5,"acronym":6,"body":7,"category":77,"description":78,"difficulty":79,"extension":80,"letter":81,"meta":82,"navigation":83,"path":84,"related":85,"seo":90,"sitemap":91,"stem":94,"subcategory":6,"__hash__":95},"terms\u002Fterms\u002Fi\u002Findex.md","Index",null,{"type":8,"value":9,"toc":71},"minimark",[10,15,19,23,26,30,60,64,67],[11,12,14],"h2",{"id":13},"eli5-the-vibe-check","ELI5 — The Vibe Check",[16,17,18],"p",{},"A database index is like the index in the back of a book. Without it, the database reads every single row to find what you want. With it, it jumps straight to the answer. Slow queries? Add an index. Magic.",[11,20,22],{"id":21},"real-talk","Real Talk",[16,24,25],{},"An index is a data structure (usually a B-tree or hash) that improves the speed of data retrieval operations on a table. It stores pointers to rows sorted by the indexed column(s). Indexes speed up SELECT queries but add overhead to INSERT, UPDATE, and DELETE operations.",[11,27,29],{"id":28},"show-me-the-code","Show Me The Code",[31,32,37],"pre",{"className":33,"code":34,"language":35,"meta":36,"style":36},"language-sql shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","-- Slow without index, fast with it\nCREATE INDEX idx_users_email ON users(email);\nSELECT * FROM users WHERE email = 'alex@example.com';\n","sql","",[38,39,40,48,54],"code",{"__ignoreMap":36},[41,42,45],"span",{"class":43,"line":44},"line",1,[41,46,47],{},"-- Slow without index, fast with it\n",[41,49,51],{"class":43,"line":50},2,[41,52,53],{},"CREATE INDEX idx_users_email ON users(email);\n",[41,55,57],{"class":43,"line":56},3,[41,58,59],{},"SELECT * FROM users WHERE email = 'alex@example.com';\n",[11,61,63],{"id":62},"when-youll-hear-this","When You'll Hear This",[16,65,66],{},"\"Add an index on the email column to speed up lookups.\" \u002F \"Too many indexes slow down writes.\"",[68,69,70],"style",{},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":36,"searchDepth":50,"depth":50,"links":72},[73,74,75,76],{"id":13,"depth":50,"text":14},{"id":21,"depth":50,"text":22},{"id":28,"depth":50,"text":29},{"id":62,"depth":50,"text":63},"database","A database index is like the index in the back of a book. Without it, the database reads every single row to find what you want.","intermediate","md","i",{},true,"\u002Fterms\u002Fi",[86,87,88,89],"Query Optimization","Primary Key","Table","Explain Plan",{"title":5,"description":78},{"changefreq":92,"priority":93},"weekly",0.7,"terms\u002Fi\u002Findex","vsWWhO7lHdXuj56o-pdXQdFjRkJdwR6b7Jd6QwiLR3g",[97,101,105,108],{"title":89,"path":98,"acronym":6,"category":77,"difficulty":99,"description":100},"\u002Fterms\u002Fe\u002Fexplain-plan","advanced","EXPLAIN shows you exactly how the database plans to execute your query — which indexes it uses, how many rows it scans, where it is slow.",{"title":87,"path":102,"acronym":6,"category":77,"difficulty":103,"description":104},"\u002Fterms\u002Fp\u002Fprimary-key","beginner","A primary key is the unique ID that every row in a table must have. Like a social security number for your data — no two rows can have the same one.",{"title":86,"path":106,"acronym":6,"category":77,"difficulty":99,"description":107},"\u002Fterms\u002Fq\u002Fquery-optimization","Query optimization is the art of making slow database queries fast. Add an index here, rewrite that subquery as a JOIN, fetch only the columns you need.",{"title":88,"path":109,"acronym":6,"category":77,"difficulty":103,"description":110},"\u002Fterms\u002Ft\u002Ftable","A database table is exactly like a spreadsheet tab. It has columns across the top (name, email, age) and rows going down (one per person).",1776518288565]