Re: mySQL overhead: Tweaking Scripts for Speed
| From: | Chris Shiflett | Date: | Fri, 05 Sep 2003 15:46:07 +0000 |
| Subject: | Re: mySQL overhead: Tweaking Scripts for Speed | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-161776@lists.php.net to get a copy of this message | ||
--- Dan Anderson <dan@mathjunkies.com> wrote:
> I've figured out that all mySQL queries should use indexed ids for
> speed. (For anyone who doesn't know: mySQL indexes fields with ...
You can create an index yourself:
KEY [index_name] (index_col_name,...)
Find more on this page:
http://www.mysql.com/doc/en/CREATE_TABLE.html
> But how much overhead is there in:
>
> $link = mysql_connect($hostname,$username,$password) or die("");
> $db = mysql_select_db($database,$link) or die("");
This much:
|------------------|
> Would it be beneficial to run a single one at the beginning of every
> script? Currently I have a bunch of functions each with their own
> calls.
Of course. One call is faster than a bunch of calls.
Hope that helps.
Chris
=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/