Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: MySQL DBI Help

by Anonymous Monk
on Sep 22, 2001 at 23:14 UTC ( [id://114086]=note: print w/replies, xml ) Need Help??


in reply to MySQL DBI Help

Thanks for your suggestions, and your tips Ovid - I will remember that for future use.

On the suggestion of flat files, I am currently running a duplicate of this script on another server which uses flat files, I was advised to switch to a mysql database solution so that it eased the load on the system and would speed up the script.

In what instances does mysql really become the beneficial choice if its more suitable to hold 20,000 email addresses in a flat file?

Thanks

Replies are listed 'Best First'.
(Ovid) Re(2): MySQL DBI Help
by Ovid (Cardinal) on Sep 22, 2001 at 23:54 UTC

    I understand that MySQL has recently had some improvements to bring it closer to ACID compliance, but I am still leery of it. MySQL, as I have used it, is as best a file system with SQL, not a database. An excellent explanation of the limitations of MySQL is at Why Not MySQL (and explains what "ACID compliant" means). As for Open Source alternatives to MySQL, you can check out Postgresql or Interbase.

    I do not know who recommended MySQL to you or why it was recommended. If the only consideration is performance, I would strongly recommend that you examine this decision more carefully. One thing that many people misunderstand in making technology decisions is that the technology chosen is part of the answer. In order to answer a question properly, you need to get enough information to understand what the question is. With technology choices, we need to identify the problem solved, determine what resources we can apply to these problems and determine how the pros and cons of those resources affect our short and long term goals. Then, and only then, do we begin to have an adequately defined question. Once we have the parameters of the problem and possible solutions clearly defined, then we can begin to decide what technology solutions are an appropriate fit. Here are a few questions off the top of my head regarding that would affect whether or not MySQL is an appropriate solution for your problem:

    • What, exactly, is the problem that you need to solve?
    • Do you already have technologies in-house that may be applicable (this is important because just throwing another technology at a solution means more technologies to support -- too many technologies is like too many cooks!)
    • If you need a database, how many users are likely going to be using the system?
    • Will the database be primarily "read only"? (MySQL can be fine for that purpose)
    • Do you have the in-house capability to adequately support MySQL? Is there only one person who can support it? What happens if they leave?

    The last question is particularly vexing. At work, we primarily use MS SQL Server because that is the database the most of us are familiar with. For some of our projects, we are thinking about switching to Postgres, but there's some resistance due to the lack of in-house knowledge of the product. Unfortunately, that can be a valid complaint if we have acceptable alternative solutions.

    Cheers,
    Ovid

    Vote for paco!

    Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.

Re: Re: MySQL DBI Help
by jlongino (Parson) on Sep 23, 2001 at 01:14 UTC
    I agree with CubicSpine and Ovid that you might want to re-evaluate the decision to use mysql. The only advantage to using mysql in these circumstances would be to enhance your perl/database skills. If this were the only consideration then by all means, continue doing so. But, OTOH, if the following are true:
    • each record in the file contains only one field, e-mail address.
    • once you get the file, you are the only person using it.
    • you don't expect that format of the file to change anytime soon (like by adding new fields per record).
    Then there is nothing that mysql can do that you can't do faster working with plain text files.

    I work with a file that has 48,193 94-byte records. On our ancient Sun Sparc 10, it takes 3 whole seconds to load the entire file and store it in an array. On our Sun Enterprise 350, it takes less than a second.

    In my case, however, I have to break each record into 10 fields, be able to sort across multiple non-contiguous fields, perform merges and complex selects. So I should consider using a database implementation even though the file is used only by me and is never updated (except when I replace the entire file weekly).

    "Make everything as simple as possible, but not simpler." -- Albert Einstein

Re: Re: MySQL DBI Help
by CubicSpline (Friar) on Sep 23, 2001 at 01:44 UTC
    AM - I think that you will find that using a SQL database will give you a major advantage in situations where you are dealing with:
    • More complex data than just a single field
    • An application that does more than just "get everything in the database".
    In your situation, it might be worth doing some benchmarking. It wouldn't be too hard to set up a time test comparing reading in all the records from the DB and reading in all the records from a file. I think that if you can prove to your coworkers that the load is minimal then you should go with the file. Of course, this does depend on how often you expect to be performing this operation.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://114086]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (2)
As of 2024-04-25 19:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found