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

P

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

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?
 
G

Gregory Toomey

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
 
T

Tassilo v. Parseval

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
 
R

Ron Reidy

See below ...

Public said:
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.
 
E

Eric J. Roode

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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-----
 
T

Tad McClellan

Public Interest said:
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
 
R

Randal L. Schwartz

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!
 
B

Bart Lateur

Public said:
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.
 
D

David K. Wall

Tassilo v. Parseval said:
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....
 
D

David Oswald

Public Interest said:
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
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top