Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: Best way to store object in db

by moritz (Cardinal)
on Mar 06, 2013 at 18:18 UTC ( #1022057=note: print w/replies, xml ) Need Help??

in reply to Best way to store object in db

Just a few random thoughts:

  • Storing objects as blobs in a database makes it (nearly) impossible to do useful searches in them. Since the power of SQL queries is the main selling point of relation database systems, that's really a pity, and you might want to consider other storage systems ("nosql")
  • If all your objects have similar structure, storing them in a proper schema would improve searchability
  • YAML doesn't capture all features of Perl 5 data structures (for example weak references).
  • Storable captures more features, but you'll generally have problems changing to a different version of Storable (or Perl, for that matter).
  • If you plan to support multiple serialization formats, store the format in addition to the actual data.

Replies are listed 'Best First'.
Re^2: Best way to store object in db
by bessarabov (Acolyte) on Mar 06, 2013 at 18:34 UTC

    Thank your for your points!

    I'm writing a module that calculated estimated time of accomplishment. After it is ready I'm planning to release it as Time::ETA. It is not complete, but you can look at the current version at github.</>

    With this module I'm solving a hi level task. I need to create web interface for long lasting tasks. I'm plannig to store serialized version of Time::ETA in database to make it simple to output current status. I think it is good solution I hide some logic in CPAN module.

    You are right that it will not be possible to search through this data, but I here I don't need it.

    You are right that YAML can't serialize a lot of thing. But some things can't be serialized in any way (for example open filehandle). In the module I'm going to serialize several scalars, so YAML will do it's job fine.

    I'm not doing to support multiple serialization formats I just want to have backward compatibility.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1022057]
[Corion]: We-ird - I hadn't known this, but Ingress and Pokemon Go (both AR games in the real world where you run around) switched from using Google Maps to OpenStreetMaps, which is great. But I wonder why, as Ingress is (was?) owned by Google/Alphabet. But ...
[Corion]: ... maybe not wholly owned, or the load on Google Maps was too high?!

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2018-03-19 09:12 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (236 votes). Check out past polls.