How SQL Statements Are Executed in a Database
When a client sends an SQL statement over TCP, the parser checks syntax and semantics and builds a query tree, the optimizer evaluates possible execution plans using statistics to estimate costs and selects the most efficient one, and the executor runs the plan, using the buffer manager for reads or the transaction manager for updates while the lock manager enforces ACID properties.
SQL execution begins when the client sends a statement over a transport protocol such as TCP.
The parser receives the SQL, performs syntax and semantic analysis, and builds a query tree.
The optimizer takes the query tree, evaluates possible execution plans (e.g., index scan, nested‑loop join, hash join), estimates their costs using statistics, and selects the most efficient plan.
The executor runs the chosen plan, invoking access methods to fetch data from storage or cache. For read‑only queries the buffer manager handles data retrieval; for UPDATE/INSERT statements the transaction manager processes them, and the lock manager enforces ACID properties.
Java Tech Enthusiast
Sharing computer programming language knowledge, focusing on Java fundamentals, data structures, related tools, Spring Cloud, IntelliJ IDEA... Book giveaways, red‑packet rewards and other perks await!
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.