Re: Indexing help

From: Date: Tue, 27 Mar 2001 08:46:44 +0000
Subject: Re: Indexing help
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-7860@lists.php.net to get a copy of this message
replies below: ""M. Verheijen"" <VERHEIJEN_M@schiphol.nl> wrote in message news:sac05e4a.038@mail.schiphol.nl... Dear reader, A newbie mysql/php-question here! I've filled a mysql-database with about 1600 records. All these records contain items which are on sale on a website. Every row contains an integer defining the category to which a item belongs. At the left of the website there are buttons linked to a php-page which does a selection like this: select * from PRODUCTS where SUBCODE = \"$SUBCODE\" As you might have guessed, every button is a link in the form of: <a href="products.php?SUBCODE=8"><img src="../button2.gif" border="0"></a> This all works well, but now my questions! Is it wise to make an index for the integer column? I assume it is because it's the row almost all queries are using in there where-statements. What kind of speed increase can I expect, will it increase the speed of query's if the workload goes to 2000 queries a hour? What's the best way to make this index, how does it works. >>>>>> i always work on the theory that i index columns that i use in the select section of a query, or a where. keys will be indexed automatically (AFAIU). the speed increase will be dramatic. i used postgres and didn't index a field (accidently) and then ran queries.then indexed it and the speed increase is huge. as for making indexes it depends what tools you use. most tools such as mysql-admin etcc will let you create indexes by a pointy clicky interface. true purists might insist on: CREATE [UNIQUE] INDEX index_name ON table [USING acc_name] from the sql command line. <<<<<<<<<<<<<<<<<<< I've read about the use of indexes in the mysql-manual and phpbuilder.net, but both are kind of short and don't tell what you're doing exactly. Anybody of you have some pointers to good webresources about indexing. >>>>>>>>>>>>>>>>>>>> i don't think you need to get into what particular type of index it is (hash, etc) but they are generally a good thing. <<<<<<<<<<<<<<<<<<<<<< Yes, I know a long list of questions ;) I hope that some of you can give me a clue or two. >>>>>>>>>>>>>>>>>>>>>>> log lists of questions are a good thing and should be warmly welcomed by everyone. <<<<<<<<<<<<<<<<<<<<<<< With best regards, Maarten Verheijen -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.db (#7860) next »