FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Storing parsed XML-elements as blobs
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Storing parsed XML-elements as blobs [message #174279 is a reply to message #174266] Mon, 30 May 2011 18:10 Go to previous message
Axel Schwenke is currently offline  Axel Schwenke
Messages: 2
Registered: May 2011
Karma:
Junior Member
Maccabi <norway(dot)maccabi(at)gmail(dot)com> wrote:
>
> I am looking for an efficient way of storing large amounts of data in
> mysql, so that it is quick to access and efficient in store.

What is "large amount"? Access based on what?

> One idea I am playing with, is parsing (deserializing) the elements
> and saving the DOMElements (in their binary existience) as BLOBS to be
> retrieved and parsed for different type of contained data when
> necessary.

Yes, this can be done.

> One danger I see is that in this way I am "bound" to a platform. I
> guess Java or Perl programs on the same platform, or even PHP program
> on a different platform, will not be able to utilize the data (is this
> really the case, BTW?).

What do you mean? A BLOB is a BLOB is a BLOB. Its an array of bytes,
in most client programming languages represented as binary string.
It does not matter what languange or platform that is.

> The question is: is it really as efficient as I imagine it to be?

It depends on what you intend to do with the data.

> The alternative is to store the XML element as a serialized string,
> deserialize it at retrieve time, and analyzing / extracting /
> modifying before re-storing as a string.

From the database point of view this is not different from storing
the binary representation. A BLOB is an opaque object to MySQL.
Just like a XML lump in textual representation. Of course there
are some XML functions which work on strings only. RTFM!

But if we talk of "efficient" in relation to RDBMS, and specifically
MySQL, then storing XML in a BLOB is not much different than storing
it in a file. Accessing rows based on content (say: matching an XPATH
expression) will be painfully slow because it does a table scan.
Things get better when you extract the data you want to use to locate
certain XML fragments and store it in separate columns (with an index).

But overall "XML" and "RDBMS" are pretty orthogonal concepts. RDBMS
operate efficiently on data with a fixed record structure. XML is the
idea of a highly flexible record structure. No good match.


XL
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: a more elegant way?
Next Topic: Print preview in php
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 29 19:51:08 GMT 2024

Total time taken to generate the page: 0.04320 seconds