newssnippetsimagesfav

Blog > Webdevelopment > Mysql > Mysql optimizing – querys with no indexes

Last articles

  • Google Plus Opens first API developer system
    Google Plus Opens first API developer system
  • Seagate GoFlex – the biggest external HDD
    Seagate GoFlex – the biggest external HDD
  • Baidu to have a new mobile OS
    Baidu to have a new mobile OS
  • How to Download YouTube Songs Onto iTunes, mp3
    How to Download YouTube Songs Onto iTunes, mp3
  • How to Download YouTube Songs
    How to Download YouTube Songs
  • Google will close 10 services
    Google will close 10 services
  • Deep Sea Wallpapers
    Deep Sea Wallpapers
  • 200 Abstract and Light Wallpapers
    200 Abstract and Light Wallpapers
  • How to test shortlinks
    How to test shortlinks
  • Huawei MediaPad – first 7 inch Android 3.2 tablet
    Huawei MediaPad – first 7 inch Android 3.2 tablet

Mysql optimizing – querys with no indexes

0

Mysql optimization of a site is one of the most important aspects of optimizing a website.

If you have a website is very important to try to optimize it better. Optimizing a site you can get rid of a greater expense to a hosting service.

The first thing i try is to  add in my.conf (config mysql) the following code:

log-queries-not-using-indexes

What is the setting above? Simply addes the mysql query logs of  a sites that  do not use an index.

In other words: to find a result in a mysql table each record’s is compared with the condition of the query.

So if you have a query that finds data into a tabl;e with 100,000 records you will notice that during the process that  mysql resources used are extremely large compared to the situation that your query has a good index. But if I can not access the file my.conf? Nothing more simple …

Natural the question that comes now is: How do I know if a query correctly selects an index?

For this there EXPLAIN the syntax of MySQL. This is the syntax for explain query:

[/php]

Explain SELECT id, username FROM users WHERE id = 3

[/ php]

The result of this query is a table with several fields that will contain two known possible_key and key.

These two fields actually shows you potential index and the index that MySQL’s chosen to use.

Soon I want to make available a mysql class that can help you easily debuggul and that contain data from this short tutorial. Soon other details …

Incoming search terms:

  • despre webdevelopment

If you liked the article share it by Twitter, Facebook and Google +1.




    A special RSS category
    A special RSS category

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>