Re: MySQL SELECT performance suggestions

From: Date: Wed, 10 Jan 2001 20:03:17 +0000
Subject: Re: MySQL SELECT performance suggestions
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-33758@lists.php.net to get a copy of this message
You can use KEY() which will add extra keys to the table. --Joe On Wed, Jan 10, 2001 at 12:58:37PM -0700, webbie@deanox.com wrote: > Could someone suggest some options here for performance improvement? > > I have a table with about 300,000 entries/records by 7 columns/fields. All of > the information varies from entry, but only one field can be declared as UNIQUE. > > I have PHP perform SELECT queries on the table, and I need to display the > results in a format of: "viewing $top to ($top+$depth) of $numrows found" > > I haven't found a way to determine $numrows without performing a second SELECT > in this format: > > $numrows = mysql_num_rows (db_query("SELECT * FROM products WHERE > $product_query")); > if ( $numrows < $depth ) { $depth = $numrows; } > $qid = db_query("SELECT * FROM products WHERE $product_query LIMIT $top, > $depth"); > > So, this takes about twice as long as it would without figuring the $numrows. > Does anyone have any suggestions as far as what can be done to speed this up? > Assume that the table in question is optimized with indexing and UNIQUE values. > > Thanks. > > Lee Howard > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net --- Joe Stump PHP Programmer www.Care2.com

« previous php.general (#33758) next »