Tuning performance in MySQL

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 in customer;

You can create 3 types of index.
  • Unique Index
  • Normal Index
  • 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. Escape special SQL characters from the input values used in the query. Use prepared statements.
Complex problems, Simple Solutions