Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a database closure?

Tags:

I came across this term called database closure.

I tried to look for it and what exactly it means but I have not found any simple explanation.

Can someone please explain what the concept of closure is and specifically what is a database closure, if it is good /bad, how it can be used or avoided ?

Also seems like there is in general a closure term: http://en.wikipedia.org/wiki/Closure_%28computer_science%29 which relates to binding of variables to function. Is a database closure related to this ?

Thanks!

like image 984
codeObserver Avatar asked Jun 12 '11 20:06

codeObserver


People also ask

How do you find the closure of a database?

How to find attribute closure of an attribute set? To find attribute closure of an attribute set: Add elements of attribute set to the result set. Recursively add elements to the result set which can be functionally determined from the elements of the result set.

What is a closure SQL?

Closure tables are plain ordinary relational tables that are designed to work easily with relational operations. It is true that useful extensions are provided for SQL Server to deal with hierarchies.

What is a closure table?

A closure table is simply a table that maintains the “transitive closure” of the parent-child relationships in the base table. So, let's say you're modelling a directory structure, and you have a “directory” table, with a foreign key “parent_dir” pointing to each row's parent directory.

What is closure in functional dependency?

The Closure Of Functional Dependency means the complete set of all possible attributes that can be functionally derived from given functional dependency using the inference rules known as Armstrong's Rules.


2 Answers

Closure is actually a relatively simple concept. When designing databases we want to know that our database tables have as little redundancy as possible. This means making sure that we can have as little relationships between sets (or tables) as possible.

An example:

If we have two sets X and Y (which you can think of as two tables called X and Y) and they have a relationship with each other as so: X -> Y (Read this as Y is dependent on X)

And we have another set Z which is dependent on Y: Y -> Z (also read as Y determines Z)

To find the closure we find the minimum number of tables that we can reach all relationships with. In this case all we need is X.

So now, when we design our database we know that we only have to have a relationship from X, and Z and Y can actually be derived from X. We can therefore make sure there are no extra relationships in our database which cause redundancy.

If you want to read more, closure is a part of a topic called normalisation.

like image 156
tushar747 Avatar answered Sep 27 '22 22:09

tushar747


Closure is mentioned in database theory / set theory discussions -- as in, Dr. Codd / design & normalization kind of stuff. It has to do with finding the minimally representational elements of sets (i.e., without redundancy, etc.). I tried reading-up on it a long time ago, but my eyes went crossed, and I got a really bad headache.

If you want to read a decent summary of closure, here is one: http://www.cs.sfu.ca/CC/354/jpei/slides/ClosureDecomposition.pdf

like image 35
Chains Avatar answered Sep 27 '22 23:09

Chains