Linux Today: Linux News On Internet Time.

More on LinuxToday

When To Use Indexes In MySQL

Apr 09, 2010, 21:04 (0 Talkback[s])
(Other stories by tsmonaghan)

"This comes up in discussions almost every new project I work on, because it's a very important thing to consider when designing a database. When deciding when and how to create an index in your MySQL database, it's important to consider how the data is being used.

"Let's say you have a database of employees. We will create it like this:

CREATE TABLE employees (
 name VARCHAR(60),
 salary decimal(10,2),
 date hired(date)

"So you will notice that this table is pretty simplistic, and doesn't really contain all the info you would need to actually manage employees, but its just for the sake of demonstration, and you could always add more later, or even make another table and use joins if you had really complex needs."

Complete Story

Related Stories: