Any thought on "Perl Database" based on "Tie:File"?

Discussion in 'Perl Misc' started by Public Interest, Oct 19, 2003.

  1. Here is what my friend told me: Database sucks and MySQL too. Try program
    without using database. Database is a file system. It is slow, take more
    space...

    But still there is many things I can not do with just simple text file, such
    as updating a record....

    I just found Tie:File which added many features to text files. Here is my
    feature request to the owner of Perl: Add Perl Database, or at least
    something called Perl Table

    For instance in file:
    symbol|price on day1|volume on day1|price on day2|price on day2|....
    IBM|98.02|203092|97.01|1212300
    SUNW|3.45|1112232|3.72|1212219

    Let me select where symbel=IBM, or let me update price on day1 where
    symbol=IBM to 99.08....

    And things like that. I don't know much about SQL, so my SQl syntax maybe
    wrong.

    Any thought on my idea?
    Public Interest, Oct 19, 2003
    #1
    1. Advertising

  2. It was a dark and stormy night, and Public Interest managed to scribble:

    > Here is what my friend told me: Database sucks and MySQL too. Try program
    > without using database. Database is a file system. It is slow, take more
    > space...


    And he graduated in software engineering from which university?

    I regularly get reads of 5000 rows/sec thru mysql.
    See http://www.w3schools.com/sql/default.asp

    gtoomey
    Gregory Toomey, Oct 19, 2003
    #2
    1. Advertising

  3. Also sprach Public Interest:

    > Here is what my friend told me: Database sucks and MySQL too. Try program
    > without using database. Database is a file system. It is slow, take more
    > space...


    In its generity, this statement is wrong. If (SQL) databases were too
    slow, major websides such as those of amazon or Ebay would have to be
    too slow, too. Databases often impose a certain overhead, like when you
    set up a connection to one. Proper databases however are optimized to
    deal efficiently with large sets of data.

    > But still there is many things I can not do with just simple text file, such
    > as updating a record....


    Indeed. And if you implemented such a mechanism, it'd very likely be
    much slower than a good database.

    > I just found Tie:File which added many features to text files. Here is my
    > feature request to the owner of Perl: Add Perl Database, or at least
    > something called Perl Table


    Owner of Perl? I'd like to meet this person. ;-)

    Anyway, Tie::File is the wrong tool for that. It's an ingenious module
    nonetheless, letting you do hard things in a very easy way. But it's slow,
    very slow compared to a real database server.

    > For instance in file:
    > symbol|price on day1|volume on day1|price on day2|price on day2|....
    > IBM|98.02|203092|97.01|1212300
    > SUNW|3.45|1112232|3.72|1212219
    >
    > Let me select where symbel=IBM, or let me update price on day1 where
    > symbol=IBM to 99.08....
    >
    > And things like that. I don't know much about SQL, so my SQl syntax maybe
    > wrong.


    A database has at the very least two components: the backend that
    manages the data and the interface to access those data. SQL is the
    interface. If you have a look at CPAN modules dealing with SQL, you'll
    notice that a lot of them don't interface with a real database server at
    all. For instance DBD::Sprite: it uses flat files as the backend so a
    real database system is never involved.

    I didn't look too closely, but I bet there's also a backend that keeps
    the data in your computer's RAM but lets you use the DBI module to
    access it with proper SQL statements. If such a backend was well written
    (preferably in C and not Perl), it could result in very fast database
    access. But it's, quite naturally, not suitable for large data sets. It
    might however be what you need since a real database is indeed overkill
    when you only have very data to deal with.

    Tassilo
    --
    $_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
    pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
    $_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
    Tassilo v. Parseval, Oct 19, 2003
    #3
  4. Public Interest

    Ron Reidy Guest

    See below ...

    Public Interest wrote:
    > Here is what my friend told me: Database sucks and MySQL too. Try program
    > without using database. Database is a file system. It is slow, take more
    > space...

    He/she is wrong! A DB is not a file system. They are not slow if your
    data model is designed correctly and your throughput is considered.

    >
    > But still there is many things I can not do with just simple text file, such
    > as updating a record....
    >
    > I just found Tie:File which added many features to text files. Here is my
    > feature request to the owner of Perl: Add Perl Database, or at least
    > something called Perl Table

    No one owns Perl. Furthermore, why add a RDBMS into Perl when there are
    modules that allow RDBMS access?

    >
    > For instance in file:
    > symbol|price on day1|volume on day1|price on day2|price on day2|....
    > IBM|98.02|203092|97.01|1212300
    > SUNW|3.45|1112232|3.72|1212219
    >
    > Let me select where symbel=IBM, or let me update price on day1 where
    > symbol=IBM to 99.08....
    >
    > And things like that. I don't know much about SQL, so my SQl syntax maybe
    > wrong.


    Get a book on SQL (MySQL would most likely work for you) and you should
    be up to seped soon.

    >
    > Any thought on my idea?


    Yes. Go back to the drawing board.

    >
    >



    --
    Ron Reidy
    Oracle DBA
    Ron Reidy, Oct 19, 2003
    #4
  5. -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    "Public Interest" <> wrote in
    news:dWokb.6707$:

    > Here is what my friend told me: Database sucks and MySQL too. Try
    > program without using database. Database is a file system. It is slow,
    > take more space...


    Your friend is very much mistaken. MySQL does not "suck". It is much
    faster than anything one could write in Perl.


    > But still there is many things I can not do with just simple text
    > file, such as updating a record....
    >
    > I just found Tie:File which added many features to text files. Here is
    > my feature request to the owner of Perl: Add Perl Database, or at
    > least something called Perl Table
    >
    > For instance in file:
    > symbol|price on day1|volume on day1|price on day2|price on day2|....
    > IBM|98.02|203092|97.01|1212300
    > SUNW|3.45|1112232|3.72|1212219
    >
    > Let me select where symbel=IBM, or let me update price on day1 where
    > symbol=IBM to 99.08....


    How do you propose finding the IBM record without reading through the
    entire file, line by line? You would need some sort of index. That
    index would take up file overhead, which you seem to want to avoid. How
    would you update the record, if the changes took up more space than the
    original record? You would either need to rewrite the whole file each
    time, or you would need some sort of buffered-indexed file system model,
    which has additional overhead and complexity.

    There are already many existing excellent database systems out there
    (MySQL, Oracle, Sybase, Informix, etc), each with its own pros and cons.
    Leave database system development to database system experts. Perl has
    interfaces to all of these systems. It is far easier and more efficient
    for a Perl programmer to use the DBI module than to create a new database
    system.

    - --
    Eric
    $_ = reverse sort $ /. r , qw p ekca lre uJ reh
    ts p , map $ _. $ " , qw e p h tona e and print

    -----BEGIN PGP SIGNATURE-----
    Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

    iQA/AwUBP5KRZWPeouIeTNHoEQIJPQCdFaQrRFbAga3FVIrKTye+rov+QBkAnjZV
    mC0Je6mR4LkpqWcWHcW1Sso3
    =ZoKV
    -----END PGP SIGNATURE-----
    Eric J. Roode, Oct 19, 2003
    #5
  6. Public Interest <> wrote:

    > Here is my
    > feature request to the owner of Perl: Add Perl Database



    > Any thought on my idea?



    Things that can be done in modules are *never* added to the core.

    Only things that really need to be in the core go in the core.

    There are a bazillion existing modules that can do What You Want,
    so you don't really need anything that isn't already existing.

    All you have to do is go find it. :)


    http://search.cpan.org/modlist/Database_Interfaces


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
    Tad McClellan, Oct 19, 2003
    #6
  7. >>>>> "Public" == Public Interest <> writes:

    Public> Here is what my friend told me: Database sucks and MySQL too. Try program
    Public> without using database. Database is a file system. It is slow, take more
    Public> space...

    Try DBD::SQLite. A full transaction-savvy SQL implementation, without
    the server!


    --
    Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
    <> <URL:http://www.stonehenge.com/merlyn/>
    Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
    See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
    Randal L. Schwartz, Oct 19, 2003
    #7
  8. Public Interest

    Bart Lateur Guest

    Public Interest wrote:

    >Here is what my friend told me: Database sucks and MySQL too. Try program
    >without using database. Database is a file system. It is slow, take more
    >space...
    >
    >But still there is many things I can not do with just simple text file, such
    >as updating a record....


    A file system is slow, so instead you use... the file system?!? And in
    the slowest possible way, no less? You realize you do have to rewrite
    the entire file (database), as soon as you change *one* record, do you?

    Databases are designed for this kind of stuff, so necessary rewrites of
    the file are minimized, and as fast as possible.

    --
    Bart.
    Bart Lateur, Oct 20, 2003
    #8
  9. Tassilo v. Parseval <> wrote:

    > I didn't look too closely, but I bet there's also a backend that
    > keeps the data in your computer's RAM but lets you use the DBI
    > module to access it with proper SQL statements.


    DBD::RAM

    :)

    Jeff Zucker wrote it, but I think he's more interested in his AnyData
    modules nowadays.

    > If such a backend
    > was well written (preferably in C and not Perl), it could result
    > in very fast database access. But it's, quite naturally, not
    > suitable for large data sets. It might however be what you need
    > since a real database is indeed overkill when you only have very
    > data to deal with.


    DBD::RAM is pure Perl....

    --
    David Wall
    David K. Wall, Oct 20, 2003
    #9
  10. Public Interest

    David Oswald Guest

    "Public Interest" <> wrote:

    > Here is what my friend told me: Database sucks and MySQL too. Try program
    > without using database. Database is a file system. It is slow, take more
    > space...
    >
    > But still there is many things I can not do with just simple text file,

    such
    > as updating a record....
    >
    > I just found Tie:File which added many features to text files. Here is my
    > feature request to the owner of Perl: Add Perl Database, or at least
    > something called Perl Table

    <nonsensical ramblings snipped>
    > And things like that. I don't know much about SQL, so my SQl syntax maybe
    > wrong.
    >
    > Any thought on my idea?


    Yes. I think you should RTFM before you go requesting anything else.
    David Oswald, Oct 21, 2003
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?SHVzYW0=?=

    HtmlArea Editor any thought

    =?Utf-8?B?SHVzYW0=?=, Apr 2, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    561
    Karl Seguin [MVP]
    Apr 3, 2006
  2. SUPER KOOL 223
    Replies:
    0
    Views:
    457
    SUPER KOOL 223
    Jul 29, 2003
  3. SUPER KOOL 223
    Replies:
    2
    Views:
    379
    SUPER KOOL 223
    Jul 30, 2003
  4. Phil Powell
    Replies:
    0
    Views:
    328
    Phil Powell
    Aug 29, 2007
  5. robic0

    Tie::File question

    robic0, Apr 8, 2006, in forum: Perl Misc
    Replies:
    3
    Views:
    119
    robic0
    Apr 9, 2006
Loading...

Share This Page