Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Any thought on "Perl Database" based on "Tie:File"?

Reply
Thread Tools

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

 
 
Public Interest
Guest
Posts: n/a
 
      10-19-2003
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?


 
Reply With Quote
 
 
 
 
Gregory Toomey
Guest
Posts: n/a
 
      10-19-2003
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
 
Reply With Quote
 
 
 
 
Tassilo v. Parseval
Guest
Posts: n/a
 
      10-19-2003
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$&."'!#+sexisexi ixesixeseg;y~\n~~dddd;eval
 
Reply With Quote
 
Ron Reidy
Guest
Posts: n/a
 
      10-19-2003
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

 
Reply With Quote
 
Eric J. Roode
Guest
Posts: n/a
 
      10-19-2003
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

"Public Interest" <(E-Mail Removed)> wrote in
news:dWokb.6707$(E-Mail Removed):

> 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+ro v+QBkAnjZV
mC0Je6mR4LkpqWcWHcW1Sso3
=ZoKV
-----END PGP SIGNATURE-----
 
Reply With Quote
 
Tad McClellan
Guest
Posts: n/a
 
      10-19-2003
Public Interest <(E-Mail Removed)> 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
http://www.velocityreviews.com/forums/(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
Randal L. Schwartz
Guest
Posts: n/a
 
      10-19-2003
>>>>> "Public" == Public Interest <(E-Mail Removed)> 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
<(E-Mail Removed)> <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!
 
Reply With Quote
 
Bart Lateur
Guest
Posts: n/a
 
      10-20-2003
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.
 
Reply With Quote
 
David K. Wall
Guest
Posts: n/a
 
      10-20-2003
Tassilo v. Parseval <(E-Mail Removed)> 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
 
Reply With Quote
 
David Oswald
Guest
Posts: n/a
 
      10-21-2003

"Public Interest" <(E-Mail Removed)> 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.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Any online information of Vignette-based servlet to Websphere-based servlet? Phil Powell Java 0 08-29-2007 01:29 PM
501 PIX "deny any any" "allow any any" Any Anybody? Networking Student Cisco 4 11-16-2006 10:40 PM
[OT] [Media] Just when you thought outsourcing couldn't get any worse... Brian MCSE 18 07-21-2004 06:29 PM
Re: lightweight XSLT-based page flow: anyone thought of this? SUPER KOOL 223 XML 2 07-30-2003 08:02 PM
lightweight XSLT-based page flow: anyone thought of this? SUPER KOOL 223 Java 0 07-29-2003 08:01 PM



Advertisments