Question

What kind of relational algebra operator would a LOAD keyword be mapped into? If it it's not a logical operator but only a physical one then how is it handled during the logical to physical operator transformation process by the database query processor? Or, if it's not mapped into relational algebra primitives is it then an implementation-specific relational algebra operator extention?

Was it helpful?

Solution 2

The LOAD keyword is internally mapped in the database after query parsing into a logical operator but it's not an algebra operator. All algebra operators are logical operators but not all logical operators are algebra operators.

OTHER TIPS

You have got to distinguish between algebraic operators such as natural join, transitive closure, ... and keywords/commands of the data manipulation language.

Algebraic operators do computations on given values, and return the computed value as their result.

And then you have programming and data manipulation languages that are built, in a certain sense, "on top" of algebraic operators. If you have an algebraic operator "integer addition", then you will also have a symbol in your language to denote invocations of that operator, say '+'. And you can have well formed formulas (wffs) that consist a.o. of such symbols. Say, e.g., 'a+b' or 'x+1'.

This is where variables pop up. Algebraic operators alone are not enough, we also need variables (at least in procedural languages). And to manipulate those variables, we need this thing called "assignment", more longwindedly, we need the assignment operator.

And just like the assignment "x := 3" can be regarded as a wff denoting an invocation of the integer assignment operator, LOAD can be regarded as a form in which the relational assignment operator can possibly appear.

The assignment operator is -obviously- not a read-only operator of the algebra, but it is the operator of your language that you use for managing state.

From mathematical point of view LOAD is not an operator at all. Because it takes a relation, stored in a file, and puts the same relation into the database.

So, we get 2 physical copies of the same relation, but mathematically no operation was executed. You can regard it as a trivial selection operation, unconditionally selecting all the tuples from the relation.

"how is it handled during the logical to physical operator transformation process by the database query processor?"

MySQL executes the appropriate function after parsing the query. This function reads the given file and loads the data into the table.

I don't think, that MySQL developers concerned about such abstract things as existence of an operation, mapping LOAD, in relational algebra.

LOAD is not an operator at all; it is just a reserved word in MySQL (and other RDBMSs). Each RDBMS has it's own list of "reserved words".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top