Advertisement: Jobs in UAE, Saudi Arabia, Qatar, Pakistan, Bahrain & other regions. Click here to find one for you.

MySQL FAQs
FAQs Categories
Client Server Commands
Database Structure
Table Types or Storage Engines
Indexes
SQL Statements
Table Joins
Funtions and Operators
Tricky Select Queries
Speed Up Queries
Data Back Up
General Questions
Errors
Powered by MySQL
 
Home / Indexes / Question No: 69

What are advantages and disadvantages of indexes in MySQL?

Select queries in my database and also search area of my site seems working. I assume indexing is required to add into my tables. I am new to MySQL and on learning ways. So I need to know about the MySQL indexing. Can the indexing can improve my select queries performance. Also, is any disadvantage of MySQL indexing? Please explain!

Answer No: 69

Indexing is one of the more useful features of MySQL. MySQL allows several types of indexes like primary key index, unique index, normal index also known as ("non-unique index", ordinary index, index without constraints") and full-text index. Of course, the indexes improve SELECT queries speed tremendously. but, they do have some considerable disadvantages as well.

Advantages of MySQL Indexes

Generally speaking, MySQL indexing into database gives you three advantages:

  • Query optimization: Indexes make search queries much faster.
  • Uniqueness: Indexes like primary key index and unique index help to avoid duplicate row data.
  • Text searching: Full-text indexes in MySQL version 3.23.23, users have the opportunity to optimize searching against even large amounts of text located in any field indexed as such.

Disadvantages of MySQL indexes

When an index is created on the column(s), MySQL also creates a separate file that is sorted, and contains only the field(s) you're interested in sorting on.

Firstly, the indexes take up disk space. Usually the space usage isn’t significant, but because of creating index on every column in every possible combination, the index file would grow much more quickly than the data file. In the case when a table is of large table size, the index file could reach the operating system’s maximum file size.

Secondly, the indexes slow down the speed of writing queries, such as INSERT, UPDATE and DELETE. Because MySQL has to internally maintain the “pointers” to the inserted rows in the actual data file, so there is a performance price to pay in case of above said writing queries because every time a record is changed, the indexes must be updated. However, you may be able to write your queries in such a way that do not cause the very noticeable performance degradation.

Related MySQL FAQs to the Above FAQ

How-to-get-existing-indexes-of-the-table-in-MySQL How to get existing indexes of the table in MySQL?

What-is-index-terminology-or-concept-and-how-does-index-work-in-MySQL What is index terminology or concept and how does index work in MySQL?

How-many-types-of-indexes-or-keys-are-in-MySQL How many types of indexes or keys are in MySQL?

What-is-single-column-index-or-key-in-MySQL What is single column index or key in MySQL?

What-is-multi-column-index-or-key-in-MySQL What is multi column index or key in MySQL?

What-is-partial-column-and-prefixed-column-index-or-key-in-MySQL What is partial-column and prefixed-column index or key in MySQL?

When-does-multi-column-index-come-into-use-in-MySQL When does multi column index come into use in MySQL?

What-are-best-practices-to-pick-columns-to-index What are best practices to pick columns to index?

How-to-remove-or-drop-indexes-in-MySQL How to remove or drop indexes in MySQL?

Is-it-possible-to-apply-more-than-one-keys-on-a-single-column Is it possible to apply more than one keys on a single column?

What-is-foreign-key-in-MySQL What is foreign key in MySQL?

About FAQs: Recently Added FAQs

About MySQL FAQs: Site Map | Bookmark Us | Recommend this Site to Your Friend | Contact Us

Useful Links: Sulata iSoft - Limitless Solutions | Limitless Job Opportunities - Careermidway.com

© 2007 - 2014  www.mysqlfaqs.net
All rights reserved. The site is owned and operated by Mr. Javed Bhatti - Pakistan.