[Haskell-cafe] relational data representation in memory using
haskell?
Marc Weber
marco-oweber at gmx.de
Thu May 22 07:25:07 EDT 2008
On Thu, May 22, 2008 at 12:48:42PM +0200, Salvatore Insalaco wrote:
> 2008/5/22 Marc Weber <marco-oweber at gmx.de>:
> > So in haskell it would look like this:
> > let updatedCd = 0x22 CD (0x6 "My song") (0x20 ( 0x23 : ...)
> > updatedTrack = 0x23 Track ( 0x21 "updated track title" ) 0x22
> > in (0x27) DB (0x24 (updatedCd:otherCds)) (0x25 (updatedTrack:otherTracks))
>
> Mmmm I don't think that this is a good way to go.
> Let me do a counter-example:
>
> data A = A String
> data B = B String [A]
> data C = C String [B]
> data D = D String [C]
>
> A little change like changing the String in A requires updating the whole "DB".
You're right. Very bad idea unless you only insert once a year and only
have queries the whole day.
The only way to fix this is by separating relational data from record
data.
> data A = Map RecordDataA RelationalDataA
> data B = Map RecordDataB RelationalDataB
So when changing a field in RecordDataA only the relational data B would
have to be updated.. but I see that that's not that good either.
Fine. Then the only way to go is using uniq ids as keys the way it's
already done everywhere
Thanks
Marc W
More information about the Haskell-Cafe
mailing list