Piyush Posted September 22, 2009 Share Posted September 22, 2009 How can we use database more efficently so that we can make our website more fast.Please suggest some ways in which the databse should be handled.. Link to comment Share on other sites More sharing options...
boen_robot Posted September 22, 2009 Share Posted September 22, 2009 Performance in general is a cost/benefit ratio that you must work out. If a cost is acceptable for the performance benefits for making it, then do it.Some things in general:1. Write efficient queries, that fetch the least amount of needed data, but no less. If there's a faster way to get everything you need, without getting anything extra, do use it.2. Connect to the database as rarely as possible. If your server side language of choise can persist connections (as with PHP's mysql_pconnect()), do use this ability.3. If you need to use a result from a database more than once, do not execute a second query to refetch it. Instead, store the result, and then reuse it when needed.4. When possible and feasable (depending on the scenario), do not store the query results (e.g. in PHP, use mysql_unbuffered_query()).5. If you do not store the query results or the result set is expected to be of "medium" size, make sure to make as few queries as possible. Otherwise, if the query result is expected to be big, make a few separate queries instead of a single big one. The exact definitions of "medium" and "big" depend on the available RAM memory for your server side language. Link to comment Share on other sites More sharing options...
Synook Posted September 22, 2009 Share Posted September 22, 2009 Also, make maximum use of JOIN, GROUP BY and related constructs - avoid sending multiple queries to get related information. Link to comment Share on other sites More sharing options...
justsomeguy Posted September 23, 2009 Share Posted September 23, 2009 Get a book:http://oreilly.com/catalog/9780596101718/ Link to comment Share on other sites More sharing options...
Piyush Posted September 23, 2009 Author Share Posted September 23, 2009 Thanks...for suggestions Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.