Tuning MySQL Server Performance

Indexing is used to speed up the performance of the database.
We can create an index on a specific column in a table containing huge number of rows.

To view what index is being used on the table, you can use below syntax.
SHOW INDEX FROM CUSTOMER
show index in customer;

You can create 3 types of index.

  1. Unique Index
  2. Normal Index
  3. FullText Index

CREATE UNIQUE INDEX `idin` on `temptable` (`Id`);

CREATE INDEX `name` on `temptable` (`FirstName`);

ALTER TABLE `temptable` ADD INDEX `name` (`FirstName`);

ALTER TABLE `temptable` DROP INDEX `name`;

ALTER TABLE `temptable` Add FULLTEXT lname(`LastName`);

Preventing performance issues due to SQL attacks

To prevent SQL injection, you need to do below things.

  1. Escape special SQL characters from the input values used in the query.
  2. Use prepared statements.

You may also like...