# Re: Can relational alegbra perform bulk operations?

Date: Tue, 29 Sep 2009 17:46:10 -0700 (PDT)

Message-ID: <26e1631d-0c46-44e3-8009-c0eace95d9bc_at_c3g2000yqd.googlegroups.com>

**TIA,**Perhaps you want the EXTEND operator:

**EXTEND R ADD A+B AS C**

This results in a relation like R but with a new attribute C; each result tuple's C value is its A value plus its B value.

More generally, if you think of an operator like + as corresponding
to a relation PLUS with numeric attributes LEFT, RIGHT and RESULT

*(consisting of all possible tuples where LEFT + RIGHT = RESULT)*

then the above is equivalent to

** R JOIN (PLUS RENAME LEFT AS A, RIGHT AS B, RESULT AS C)
**
Of course optimizers use algebraic identities to rewrite.
They just also use other information like size and indices
to create a tree with some optimized property.
The biggest time expense tends to be

secondary storage page access.

It might seem such things have to be implemented as loops,
but it all depends on your implementing machine.
Maybe it is a parallel processor.

If you want the longest stick of spaghetti you just hold
them all upright on the counter.

If relational algebra were presented properly you would find that
first of all it is an algebra schema,

since every set of types produces a different algebra;
that those algebras are "many-sorted", the sorts being relations,
attributes, sometimes attribute lists, sometimes quoted-expressions,
and the types;

and that you would have additional operators like
ONE_BY_ONE_RELATION_type(ATTRIBUTE, value) returning a relation
and VALUE_type(relation) returning a value of the type.

*(You don't need to have explicit tuples.)*

philip Received on Tue Sep 29 2009 - 19:46:10 CDT