Forum Moderators: open
TABLE 'place' (
id,
name,
longitude,
latitude,
country,
state,
street name,
...
)
However, I realized that in a way, a state is also a 'place', so i thought of having a hierarchical place, where the table 'place' has one more column 'parent_id' and a column called 'relationship_with_parent'. So every place will have a parent place.
For example, the Google's headquater
Google Inc.
1600 Amphitheatre Parkway
Mountain View, CA 94043
would, possibly, be decomposed into 5 rows (with made up ids) as follows:
(id, name, parent_id, relationship_with_parent)
row1: 1, Google Headquater, 2, number 1600
row2: 2, Amphitheatre Parkway, 3, inside
row3: 3, Mountain View, 4, postcode 94043
row4: 4, California, 5, state of
row5: 5, US, 6, country of
row6: 6, America, none, top_level
As you can see, the 'relationship_with_parent' is very very roughly defined.
Can you, webmasters, please point out for me what would be the pros/cons of this design? Can this DB scale?
Thanks in advance
P/S: Is this somewhat similar to the schema for Google maps' DB, at all?
And I'm not sure which would be the best option for a scalable DB in this case?
For example, take the houses numbered from 1 to 100 on one street as an example. All of those 100 rows will contain exactly the information on country, state ...
I humbly suggest that you read up on normalisation and then heed piatkow's advice about creating a properly normalised data model, with emphasis on the term model [google.com]
I am only extremely concerned with performance. One of the SELECT queries I might do, for example, is to find out the details of all the houses number 35 in California (in any street)
That's why I am asking here. Anyone please be kind enough to roughly suggest a schema?
(I hope i'm not so confusing..)
Please note: db design is NOT a trivial task
This does not mean it's 'rocket science' - but there IS a learning curve
Once you know the rules, you can break them (denormalise) for speed... but... I have a hunch that - even with a gazillion records, the benefits of denormalisation may well be not only negligible but also negated by increased maintenance costs (labour and time)
Whatever... learn the rules first, or hire someone who knows 'em already
:)
All of those 100 rows will contain exactly the information on country, state ...
One of the SELECT queries I might do, for example, is to find out the details of all the houses number 35 in California (in any street)