faqts : Computers : Databases : MySQL : Language and Syntax

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

13 of 16 people (81%) answered Yes
Recently 9 of 10 people (90%) answered Yes

Entry

what is an index?

Oct 21st, 2004 18:14
John Nunez, Harutyun Margaryan,


An index is a list of sorted record pointers based on a column. Having
indexes on your database tables will speed up SELECT queries if it is
properly applied.  Indexes will take up some disk space and will slow
down INSERT and UPDATE queries.

Example: if you have a table with products sold at your store. Creating
an index on the product name would speed up any searches based on
product names.

TABLE
========================
| ID | PRODUCTS | COST |
========================
| 1  | Apples   | .35  |
| 2  | Oranges  | .55  |
| 3  | Peaches  | .65  |
| 4  | Pears    | .95  |
| 5  | Berries  | .05  |
========================

INDEX BASED ON PRODUCTS FIELD
===================
| INDEX | POINTER |
===================
| Appl  | 0x023df |
| Berr  | 0x024df |
| Oran  | 0x025df |
| Peac  | 0x026df |
| Pear  | 0x027df |
===================

This is overly simplified!