[OT] large db question about no joins

Daniel Fetchinson fetchinson at googlemail.com
Fri Apr 17 11:12:11 EDT 2009


>> Well, I gave the concrete example of zoo/cage/animal/leg because this
>> *is* the business logic. I need to know for example the total number
>> of animals, this is pretty understandable if you have a zoo. Or you
>> mean that I should give another example?
>
> It might be the business logic but not the process.
> http://en.wikipedia.org/wiki/Business_process
>
>>> Using the business process I could probably
>>> narrow down the scope quite a bit like,
> <cut>
>> No, I'd like to have the exact number at any given time.
> Fair enough, but this is then the *exact* scope you like to answer me in.
>>
> <cut>
>> Let's say I need to implement this on the google app engine, so I
>> can't make too many choices on my own. On the GAE, how would I do
>> this?
> All other data modeling (e.g. EAV, relational, object orientated) will
> result in a structure requiring extra calculation when doing the query
> (and thus according your requirement isn't acceptable).
>
> So I need to store the data in such a way that it is accessible before
> the query with the minimal amount of processing.
>
> Thus the only thing left is writing a subroutine in my code which
> recalculates the amount of legs when there is a change in it and store
> it just as a pair value:
> amount_of_legs = Positive Integer

Actually, this is a pretty good idea! In my case there are not so many
writes, but tons of reads. So doing this is actually absolutely
feasible.

> The thing with bogus requirements for an imaginary example is that the
> solution is imaginary bogus too, leaving little room for applicability
> in the real world.

It's not so bogus I think. But here is another example, even more
concrete, maybe that will show more clearly what I'm talking about,
sorry if I was not clear enough: let's say you have a music store and
you have cd's in the store.

In an relational database setting you would have a table for artists,
a table for cd's and a table for songs and a table for comments where
people can comment on songs. All of this with obvious foreign keys.
Now you want to display on your website the total number of cd's, the
total number of songs and the total number of comments because that
looks very cool on top of every page: 1242342 cd's and 134242342342
songs and 284284728347284728 comments!

Okay, so you need to issue a query with joins in your relational db.
Or in another query, you want to select all comments of an artist,
meaning all comments that were comments on a song belonging to cd's of
a given artist. This would also involve joins.

How would I do these queries if I can't have joins or in other words
how would I lay out my data storage?

Thanks by the way for your help and replies,
Daniel

-- 
Psss, psss, put it down! - http://www.cafepress.com/putitdown



More information about the Python-list mailing list