What is Table Elimination?

The basic idea behind table elimination is that sometimes it is possible to resolve a query without even accessing some of the tables that the query refers to. One can invent many kinds of such cases, but in Table Elimination we targeted only a certain class of SQL constructs that one ends up writing when they are querying highly-normalized data.

The sample queries were drawn from “Anchor Modeling”, a database modeling technique which takes normalization to the extreme. The slides at the anchor modeling website have an in-depth explanation of Anchor modeling and its merits, but the part that's important for table elimination can be shown with an example.

Suppose the database stores information about actors, together with their names, birthdays, and ratings, where ratings can change over time:

actor-attrs

According to anchor modeling, each attribute should go into its own table:

  • the 'anchor' table which only has a synthetic primary key:

  • a table for the 'name' attribute:

  • a table for the 'birthdate' attribute:

  • a table for the ‘rating’ attribute, which is historized:

With this approach it becomes easy to add/change/remove attributes, but this comes at a cost of added complexity in querying the data: in order to answer the simplest, select-star question of displaying actors and their current ratings one has to write outer joins:

Display actors, with their names and current ratings:

We don't want to write the joins every time we need to access an actor's properties, so we’ll create a view:

This will allow us to access the data as if it was stored in a regular way:

And this is where table elimination will be needed.

See Also

  • This page is based on the following blog post about table elimination:?p=58

This page is licensed: CC BY-SA / Gnu FDL

Last updated

Was this helpful?