While in Freshdesk, during feature development, I was expected to optimize each and every query that was fired as part of feature and many a times, to have better response times, the existing queries also need to be optimized. In local development, it was very tiresome to look through the rails server logs to find out the join queries, unexpected table's queries and unwanted load queries. In order to get a holistic and organised view of the queries from the rails server log, I wrote this tiny standlaone app using angular.
This App does not require a backend and can run in any browser. This app is used to categorise the queries by tables and by type from the Rails Server Log in the console.
All you have to do is
- Download or clone this repo.
- Open the "index.html" file in any browser.
- The first page will have a plain text box to input the SQL log.
5. Voila. Now you will be shown a page where you can select the table.
6. After selecting the table you can select the type of query related to that table.
7. Right after you select type, all the queries of that type related to that table you selected will be listed below.
Checkout the live demo of the app here: https://sony-mathew.github.io/sql-log-analyzer/
I have used a third party javascript library for parsing the SQL Queries. This libary is called simpleSqlParser and it's an awesome library, without which it would have been very difficult.