Ok, So I have (re)searched a lot regarding MySQL Indexes and their importance and I understand i have to use it to make database queries run faster.,
And i know the syntax to add index on any filed.
But here's what i don't understand, ( I am using Heidi SQL to manage database locally )
I have a table with the following fields
id
company_id
author_id
client_id
project_id
title
description
status
date
Here, id
is the primary key
, auto incremented
and is already indexed
.
I want to add an index on company_id
, author_id
, client_id
, project_id
, But i have few different options here (Heidi SQL: select field, right click, create new index ) Key
, Unique
, Full Text
, Spatial
I know (guess) Key
will just index the field, Unique
will make sure that the field has to be unique and Full Text
index will be best if i plan to perform search on that field.
Question 1
: What does Spatial
do, where and when should i use this index.
Question 2
: While creating and index, I have 2 options, Either create a new index or Add to an already existing index (like the name of primary field).
What's the difference between creating a new index OR adding to an already existing index? Is creating an index under different name for every different field i index a good idea or should i create/add all the indexes under the same name.
Thanks for you time.