Re: Web application?

From: Date: Sat, 14 Jul 2001 07:27:36 +0000
Subject: Re: Web application?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-57854@lists.php.net to get a copy of this message
Inércia Sensorial pressed the little lettered thingies in this order... > I am sorry, maybe going a little off-message here, but what would do you > mean by eliminate 'table-scans'? > > -- What is typically referred to as a "table scan" is any operation that requires scanning of the entire table to get the results (i.e. querying on non-indexed fields). Sometimes it isn't possible to avoid this behavior, but you should try to limit queries (especially on large tables) to indexed fields as much as possible. For example: Create two tables 1) with the fields "Name" and "ID" where the "ID" field is indexed 2) with the fields "ID" (ID from the previous table instead of the "Name" of the item) and fields for the other parameters To query the second table for data, you create a drop-down box that shows users the "Name", but sends the SQL server the ID number (both retrieved from the first, smaller table). The resulting query on your larger table is: WHERE ID='$ID' Which is multitudes faster (the field is indexed, therefore the SQL server knows exactly where to find it/them and doesn't have to sort through every record) than: WHERE Name='$Name' Where the "Name" field is not indexed (the SQL server has to search every record in the database for a match) There are several cases and uses of indexes where indexing can slow your server down considerably, but that's WAY beyond the scope of an e-mail message. If you want to find out more about that stuff, I recommend the book called "MySQL" by Paul DuBois. Have fun... Christopher Ostmo a.k.a. tech@AppIdeas.com AppIdeas.com Innovative Application Ideas Meeting cutting edge dynamic web site needs since the dawn of Internet time (1995) Business Applications: http://www.AppIdeas.com/ Open Source Applications: http://open.AppIdeas.com/

« previous php.general (#57854) next »