Q. How will you optimize a SELECT query in MySQL?
We can use following options to increase the speed of a SELECT query in MySQL:
I. Index: We can create index on the columns that are used in WHERE clause of SELECT statement.
II. Function Isolation: We can check whether a function is being called multiple times or one time. By isolating the specific function that takes longer time in a query, we can optimize it to improve the overall performance of a query.
III. Full Table Scan: Wherever possible we should minimize the full table scan in a query. We can use optimal WHERE clause to do this.
IV. Table Statistics: MySQL has an in-built optimizer that can optimize a sql query. But it needs current statistics from the table. To keep the statistics up to date we can run ANALYZE statement on a table.
V. Memory: We can also adjust the size and properties of Memory area to optimize the execution of a query in MySQL.
Watch more Playlists:
System Design Interview Questions: • System Design Interview Questions
Software Architect Questions: • Software Architect Interview Questions
Microservices Questions: • Microservices Interview Questions
Devops Interview Questions: • DevOps Interview Questions
Connect with us:
Facebook: / knowledgepowerhouse
Twitter: / knowledgepowe10
Amazon: https://www.amazon.com/Knowledge-Powe...
Site: www.knowledgepowerhouse.com
Learn more MySQL interview questions, join our popular MySQL Interview Questions Preparation Course with more than 50 questions for $10 only today!!
https://www.udemy.com/mysql-interview...