Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #1924 > unrolled thread

Storing parsed XML-elements as blobs

Started byMaccabi <norway.maccabi@gmail.com>
First post2011-05-29 23:42 -0700
Last post2011-05-30 20:10 +0200
Articles 4 — 4 participants

Back to article view | Back to comp.lang.php


Contents

  Storing parsed XML-elements as blobs Maccabi <norway.maccabi@gmail.com> - 2011-05-29 23:42 -0700
    Re: Storing parsed XML-elements as blobs Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-30 08:57 -0400
      Re: Storing parsed XML-elements as blobs Mathieu Maes <mathieu@webberig.be> - 2011-05-30 07:57 -0700
    Re: Storing parsed XML-elements as blobs Axel Schwenke <axel.schwenke@gmx.de> - 2011-05-30 20:10 +0200

#1924 — Storing parsed XML-elements as blobs

FromMaccabi <norway.maccabi@gmail.com>
Date2011-05-29 23:42 -0700
SubjectStoring parsed XML-elements as blobs
Message-ID<fcf3d875-9f2b-4f56-96ff-39fe409bf0b7@v10g2000yqn.googlegroups.com>
Hello!

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. Im using
PHP.

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.

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?).

The question is: is it really as efficient as I imagine it to be?
could the efficiency outweigh the disadvantages?

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.

Any experience / know-how out there?

Thanks a lot!

Michael

[toc] | [next] | [standalone]


#1932

FromJerry Stuckle <jstucklex@attglobal.net>
Date2011-05-30 08:57 -0400
Message-ID<is0475$2ck$1@dont-email.me>
In reply to#1924
On 5/30/2011 2:42 AM, Maccabi wrote:
> Hello!
>
> 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. Im using
> PHP.
>
> 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.
>
> 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?).
>
> The question is: is it really as efficient as I imagine it to be?
> could the efficiency outweigh the disadvantages?
>
> 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.
>
> Any experience / know-how out there?
>
> Thanks a lot!
>
> Michael
>

Impossible to tell from your description.  The best way to save data is 
almost always based on what the data is.

Personally, I don't save DOM elements or XML in MySQL.  I save the data.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#1935

FromMathieu Maes <mathieu@webberig.be>
Date2011-05-30 07:57 -0700
Message-ID<ccf06097-037b-4fb5-8cb2-8eb961af9e27@e17g2000prj.googlegroups.com>
In reply to#1932
On 30 mei, 14:57, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> On 5/30/2011 2:42 AM, Maccabi wrote:
>
>
>
>
>
>
>
>
>
> > Hello!
>
> > 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. Im using
> > PHP.
>
> > 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.
>
> > 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?).
>
> > The question is: is it really as efficient as I imagine it to be?
> > could the efficiency outweigh the disadvantages?
>
> > 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.
>
> > Any experience / know-how out there?
>
> > Thanks a lot!
>
> > Michael
>
> Impossible to tell from your description.  The best way to save data is
> almost always based on what the data is.
>
> Personally, I don't save DOM elements or XML in MySQL.  I save the data.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================

Hi Michael,

Everything depends on how you want to use the data. Storing XML or
serialized objects in a database may result in certain limitations,
ie. if you want to perform queries on the data.

Serializing may not be a good idea if the data needs to be available
from different platforms.


Kind regards,
Mathew

[toc] | [prev] | [next] | [standalone]


#1941

FromAxel Schwenke <axel.schwenke@gmx.de>
Date2011-05-30 20:10 +0200
Message-ID<953db8-rb9.ln1@xl.homelinux.org>
In reply to#1924
Maccabi <norway.maccabi@gmail.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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web