dbTalk Databases Forums  

Designing DB in accordance with the relational model

comp.databases.theory comp.databases.theory


Discuss Designing DB in accordance with the relational model in the comp.databases.theory forum.



Reply
 
Thread Tools Display Modes
  #11  
Old   
Clifford Heath
 
Posts: n/a

Default Re: Designing DB in accordance with the relational model - 11-11-2010 , 07:33 PM






Roy Hann wrote:
Quote:
Clifford Heath wrote:
[Nulls] are an
efficiency feature, added to allow a reduction in the number of
physical tables required,
*PLONK!* And on so many levels too.
Twat.

If you want to avoid NULLs, you add tables. Cleaner, but typically slower.
Perhaps not the way it should be, but the way existing RDBMS' are.

Reply With Quote
  #12  
Old   
Kentauros
 
Posts: n/a

Default Re: Designing DB in accordance with the relational model - 11-12-2010 , 04:28 AM






On Nov 12, 12:25*am, Gene Wirchenko <ge... (AT) ocis (DOT) net> wrote:
Quote:
* *It sounds as if you are getting into premature optimisation.
Well. I'd rather think of it as a willing to do everything correctly
from the very start. Right now, I am thinking about logical level,
i.e. the set of relvars an application will see and work with. On a
level of SQL planning I will use wide tables with NULLs in them, no
doubts.

On Nov 12, 4:33*am, Clifford Heath <n... (AT) spam (DOT) please.net> wrote:
Quote:
Roy Hann wrote:
Clifford Heath wrote:
[Nulls] are an
efficiency feature, added to allow a reduction in the number of
physical tables required,
*PLONK!* *And on so many levels too.

Twat.

If you want to avoid NULLs, you add tables. Cleaner, but typically slower..
Perhaps not the way it should be, but the way existing RDBMS' are.
If I want to avoid using NULLs on a logical level (and I do), I'd just
add views which are projections of a NULL-containing table and would
work with them only, not with the table itself. Well, it would require
some self-control to not touch the table but only the views derived
from it.

Reply With Quote
  #13  
Old   
Cimode
 
Posts: n/a

Default Re: Designing DB in accordance with the relational model - 11-12-2010 , 05:37 AM



On 10 nov, 10:18, Roy Hann <specia... (AT) processed (DOT) almost.meat> wrote:
Quote:
Clifford Heath wrote:
[Nulls] are an
efficiency feature, added to allow a reduction in the number of
physical tables required, as a concession to the physical access
characteristics of mechanical storage devices.

*PLONK!* *And on so many levels too.
An *efficiency feature*. Never heard that one before. Typical mumbo
jumbo.

Regards...
> Roy

Reply With Quote
  #14  
Old   
paul c
 
Posts: n/a

Default Re: Designing DB in accordance with the relational model - 11-12-2010 , 07:48 AM



On 12/11/2010 3:37 AM, Cimode wrote:
Quote:
On 10 nov, 10:18, Roy Hann<specia... (AT) processed (DOT) almost.meat> wrote:
Clifford Heath wrote:
[Nulls] are an
efficiency feature, added to allow a reduction in the number of
physical tables required, as a concession to the physical access
characteristics of mechanical storage devices.

*PLONK!* And on so many levels too.
An *efficiency feature*. Never heard that one before. Typical mumbo
jumbo.

I must say I have heard people say exactly what Clifford wrote and I
seem to remember some app or other that separated most users from the
dbms so that they couldn't access base tables which were 'outer joins'
directly, so the application programmers never actually manipulated any
nulls. I saw that as a hack that reduced the dbms to an access method
but whether misguided or not, I'd say it's true enough that some people
think this way, putting the performance cart before the functional cart.
Personally, if there were no dbms that could handle a performance
requirement I would consider programming the app with an access method.
I think such apps are rare, perhaps found only in real-time automation
systems.


Roy H snipped the first sentence in Clifford H's paragraph: "You
shouldn't need NULLs in your conceptual model." I don't see any reason
to plonk that, nor the rest which could have been valid sarcasm. For me
the big problem with nulls is that I don't know how to express them in a
predicate. (Until the late 1990's, I never thought much about
predicates only because I hadn't seen much written about them. Instead,
I had thought of relations as being abstractions of what I called
uniform sentences. This 'thinking' was casual and a little fuzzy, not
formal at all but it did at least prevent me from associating two 'very
unlike' sentences with the same 'table'.)

Reply With Quote
  #15  
Old   
paul c
 
Posts: n/a

Default Re: Designing DB in accordance with the relational model - 11-12-2010 , 07:55 AM



On 12/11/2010 5:48 AM, paul c wrote:
Quote:
putting the performance cart before the functional cart
Oops, meant performance fart before the functional horse or suchlike.

Reply With Quote
  #16  
Old   
paul c
 
Posts: n/a

Default Re: Designing DB in accordance with the relational model - 11-12-2010 , 12:39 PM



On 11/11/2010 11:32 AM, Hugo Kornelis wrote:
Quote:
On Wed, 10 Nov 2010 15:54:26 -0800 (PST), Kentauros
joker.vd (AT) gmail (DOT) com> wrote:

On Nov 11, 12:39 am, Hugo Kornelis
h... (AT) perFact (DOT) REMOVETHIS.info.INVALID> wrote:

...
The predicate "<Character> has<Defense>", for instance, is
incomplete. To complete it, you have to change it to "<Character> has
Defense> in<Game>".

The problem is, many characteristics never change at all.

But why is that a problem?
"Wario has defense 17 in Super Mario World"
"Wario has defense 17 in Super Mario World 2"
"Wario has defense 17 in Super Mario World 3D"
"Wario has defense 17 in Super Mario World - the last part"
"Wario has defense 17 in Super Mario World - the sequel to the last
part"

There is nothing wrong with this extension. The candidate key for this
relvar is (Character, Game), and there are no violations of this key,
or of any other constraint.

From your posts, I get the impression that you try to minimize the
number of distinct facts in the database. In my experience, it is
often far better to minimize the number of distinct predicates....
Maybe it's simple but I'm having a hard time understanding the above.
Is it even possible to reduce the number of predicates an app needs
without changing requirements (at least without de-normalizing)?


(By the way, I also don't see what's redundant in those 'Wario'
propositions above.)

Reply With Quote
  #17  
Old   
Hugo Kornelis
 
Posts: n/a

Default Re: Designing DB in accordance with the relational model - 11-12-2010 , 05:49 PM



On Thu, 11 Nov 2010 12:29:08 -0800 (PST), Kentauros
<joker.vd (AT) gmail (DOT) com> wrote:

Quote:
On Nov 11, 10:32*pm, Hugo Kornelis
h... (AT) perFact (DOT) REMOVETHIS.info.INVALID> wrote:
But why is that a problem?
"Wario has defense 17 in Super Mario World"
"Wario has defense 17 in Super Mario World 2"
"Wario has defense 17 in Super Mario World 3D"
"Wario has defense 17 in Super Mario World - the last part"
"Wario has defense 17 in Super Mario World - the sequel to the last
part"

There is nothing wrong with this extension. The candidate key for this
relvar is (Character, Game), and there are no violations of this key,
or of any other constraint.
The redundancy. That is what wrong.
Hi Kentauros,

I see no redundancy. These are five distinct facts. You can't remove
one of these facts without losing information.

Don't forget that in the context of databases, "redundancy" refers to
representing the same *fact* more than once, not about storing the
same *value* more than once.

However, there are alternative ways to represent the same information.
Some of them may use less facts than the five I used above; others may
use more facts. You should not mistake a difference in number of facts
stored for redundancy.

To clarify, let me forst extend my original example a bit, to two
characters and two characterstics;

"Wario has defense 17 in Super Mario World"
"Wario has defense 17 in Super Mario World 2"
"Wario has defense 17 in Super Mario World 3D"
"Wario has defense 17 in Super Mario World - the last part"
"Wario has defense 17 in Super Mario World - the sequel to the last
part"

"Peach has jump 5 in Super Mario World"
"Peach has jump 7 in Super Mario World 2"
"Peach has jump 7 in Super Mario World 3D"
"Peach has jump 7 in Super Mario World - the sequel to the last part"

As you see, the jump power of Peach is not the same in all games, and
in one game she has none.

These nine facts can also be represented in another way, if we also
represent facts about the order of these games. The alternative would
be to use these 8 facts:

"Super Mario World 2 is the sequel to Super Mario World".
"Super Mario World 3D is the sequel to Super Mario World 2".
"Super Mario World - the last part is the sequel to Super Mario World
3D".
"Super Mario World - the sequel to the last part is the sequel to
Super Mario World - the last part".

"Wario has defense 17 from Super Mario World until Super Mario World -
the sequel to the last part".

"Peach has jump 5 in Super Mario World".
"Peach has jump 7 from Super Mario World 2 until Super Mario World
3D".
"Peach has jump 7 in Super Mario World - the sequel to the last part"

Is this alternative better? Well, that depends. If you want to
minimize the number of facts, it is. If you want to minimize the
number of predicates, it isn't. If you want to minimize the amount of
bytes required to store the facts - well, I guess that depends on lots
of information I don't have. And if you want to minimize the
complexity of your queries, then, again, it depends on what kind of
queries you expect.

So which one you choose (and not just from these two; there must be
more alternatives) is up to you. As long as you stick to your choice.
You should not try to combine these alternatives - as that WOULD
introduce the redundancy you already thought to see in the first
alternative.


Quote:
I'm wondering why you have introduced a character number, and why the
CharacterName is not a candidate key. Since this is all about tracking
different characteristics of the same character in different games, I
would have expected the character name to be the most obvious
identifier for characters - or are there indeed any games with a
"Sonic" character that is not derived from the original hedgehog?
Because these CharacterNumbers exist in the games, they're visible to
players, and they behave just like AUTOINCREMENT. Well, if the game
characters have such wonderful characterstic, I surely pick it as a
primary key.
Ah, yes. That makes sense than.


Quote:
But it seems that the table Characters has to go characters have
different sets of characteristics in different games, and I can't
predict what will (dis)appear or which remained characteristic change
-- except for name.

But why would that impact the table Characters? If a character exists
in a game, you can represent that fact in this table, regardless of
his/her characteristics.
It's the work for CharacterExistence. The table Characters were
intended to store characters' characteristics. Maybe
CharactersCharacteristics would be a better name.
Unless it is possible for a character to exist in a game with no
characteristic at all (and you have already told us it isn't), the
existence of a character in a game is implied by the character having
characteristics in that game; adding a seperate relvar to store its
existence would be redundant.


(snip)
Quote:
This is not a good constraint. What will you do if a new game is
relased next month (just in time for Christmas), where special is
mandatory again? Change the constraints?
Yes. Just change the constraints. So the constraints will mean
"Special is mandatory in the first and the (currently) last games, but
is absent in any other game". It's pretty simple and won't take any
changing in table.
Most people in the field will tell you that it is not good practice to
have constraints that need to change based on foreseeable changes in
the world.
They'll also tell you that is is best not to mix data and metadata.

Your constraint violates both advices.


(snip)
Quote:
I'm also wondering about your choice to use seperate tables for each
characteristic (attack, defense, special, ...). Not that this is
really WRONG, but it might not be the best choice either. Have you
considered the predicate "<Character> has <Characteristic> <score> in
Game>" to replace all these?
Yes. And I don't think it will work. What will the domain of <score
be? Alpha? No, thank you very much. Such relation would require an
enormous number of constraints.
Yes, that is true. Welcome rock, meet hard place. You'll either have a
model that's easy to query and has lots of nasty constraints, or you
can choose a model with relatively simple constraint that is tough to
query. Neither of these choices is automatically better than the
other; it's a choice you'll have to make, based on how you expect the
system to be used.
--
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis

Reply With Quote
  #18  
Old   
Clifford Heath
 
Posts: n/a

Default Re: Designing DB in accordance with the relational model - 11-12-2010 , 07:18 PM



paul c wrote:
Quote:
Roy H snipped the first sentence in Clifford H's paragraph: "You
shouldn't need NULLs in your conceptual model." For me
the big problem with nulls is that I don't know how to express them in a
predicate.
Exactly. A logical formula uses predicates over one or more "individuals",
and has no meaning when one of the individuals may be absent.

Quote:
(Until the late 1990's, I never thought much about
predicates only because I hadn't seen much written about them.
That's because you haven't followed fact-oriented modeling, which has
been built on these ideas since its inception in the 1970s.

Quote:
Instead,
I had thought of relations as being abstractions of what I called
uniform sentences. This 'thinking' was casual and a little fuzzy, not
formal at all but it did at least prevent me from associating two 'very
unlike' sentences with the same 'table'.)
FCO-IM and NIAM are also built on such sentences. They (and ORM2)
show how to break down such sentences into elementary form, which
is where only one fact is conveyed - nothing further can be taken
away without losing information. When facts are expressed in elementary
form, there is never a need for NULLs. The result has a direct mapping
to formal logic (as Halpin's thesis proved) and thus (like RM) forms a
formal basis for designing information systems.

Fact orientation has significant communication advantages when you're
engaged in requirements capture, because of its natural-language
foundations. The tools produce properly normalized relational models
automatically.

Clifford Heath, http://dataconstellation.com

Reply With Quote
  #19  
Old   
Kentauros
 
Posts: n/a

Default Re: Designing DB in accordance with the relational model - 11-13-2010 , 09:18 AM



On Nov 13, 2:49*am, Hugo Kornelis
<h... (AT) perFact (DOT) REMOVETHIS.info.INVALID> wrote:

Quote:
Don't forget that in the context of databases, "redundancy" refers to
representing the same *fact* more than once, not about storing the
same *value* more than once.

[...] As long as you stick to your choice. You should not try to
combine these alternatives - as that WOULD introduce the
redundancy you already thought to see in the first alternative.
Oh. That makes sense. Thank you!

Quote:
Unless it is possible for a character to exist in a game with no
characteristic at all (and you have already told us it isn't), the
existence of a character in a game is implied by the character having
characteristics in that game; adding a seperate relvar to store its
existence would be redundant.
Ooops. Indeed. Thanks again.

Quote:
Most people in the field will tell you that it is not good practice to
have constraints that need to change based on foreseeable changes in
the world.
They'll also tell you that is is best not to mix data and metadata.

Your constraint violates both advices.
Well... I don't think I agree, but maybe it is just because I have to
little experience in this field. I'll think about this.

Quote:
I'm also wondering about your choice to use seperate tables for each
characteristic (attack, defense, special, ...). Not that this is
really WRONG, but it might not be the best choice either. Have you
considered the predicate "<Character> has <Characteristic> <score> in
Game>" to replace all these?
Yes. And I don't think it will work. What will the domain of <score
be? Alpha? No, thank you very much. Such relation would require an
enormous number of constraints.

Yes, that is true. Welcome rock, meet hard place. You'll either have a
model that's easy to query and has lots of nasty constraints, or you
can choose a model with relatively simple constraint that is tough to
query. Neither of these choices is automatically better than the
other; it's a choice you'll have to make, based on how you expect the
system to be used.
Well. Actually, when I query some data about character, I specify what
I want to get, so if I get (after projecting JOINS) an empty relation,
well, that just means I requested for non-existing data on this
character in this game. Or that the character itself doesn't exist...
either way, it is easy to notice and easy to find out why it
happened :-)
And again, I can use views to group data by games.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.