Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Quickest way of fetching a Single row and column in MySQL using DBI

by runrig (Abbot)
on Aug 07, 2006 at 16:39 UTC ( [id://565971]=note: print w/replies, xml ) Need Help??


in reply to Quickest way of fetching a Single row and column in MySQL using DBI

Should I even bother using a prepare cache statement for the query?

That depends on whether or not you're executing the statement multiple times. In MySQL, you get less benefit in pre-preparing your statements than in some other databases, but the answer is that you can prepare it once if you want to since selectrow_array() (which there are other examples of in this thread) accepts either a SQL statement or a previously prepared statement handle as it's first argument.

Also, depending on how often you're executing the lookup in your program, and how large the table is, you may want to just read the whole table into a hash array.

  • Comment on Re: Quickest way of fetching a Single row and column in MySQL using DBI

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2024-04-23 20:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found