Reputation: 3
I am currently doing DBMS course. While studying DDL and DML I came to realize that DDL use Interpreter and DML use compiler. Interpreter execute codes line by line and Compiler executes whole code at once. So what was the intention behine DDL using interpreter and DML using compiler.
Upvotes: 0
Views: 57
Reputation: 5171
There is no interpreter for DDL or DML queries in a RDBMS. The only part of SQL code that relies on an interpreter is the PSM (Persistent Stored Modules) collection of stored procedures, triggers and user defined functions (UDFs).
DDL commands like CREATE, ALTER or DROP just execute many DML queries on system tables. As an example, executing a CREATE TABLE statement
etc.
Upvotes: 0
Reputation: 392
The reason behind it is performance.
DDL (Data Definition Language) gives you the schema for your DB; it creates tables with fields etc. You want this to take effect immediately. That's why you use an interpreter. Also your schema most likely won't change that often compared to DML.
In DML (Data Manipulation Language) it's another story. Its challenging and difficult tasks can't be executed immediately, hence the compiler.
A simple rule of thumb (there is more to it) is that an interpreter acts faster initially but the longer it runs the more inefficient it gets compared to a compiler.
Upvotes: -1