Skip to main content

Posts

Showing posts from 2020

Optimize MySQL query with STRAIGHT_JOIN

Before finalizing my queries, I use MySQL Workbench to explain it to make sure the performance is good. I always notice that the performance of the queries with joins on multiple tables varies at times. Then I start indexing my tables to make sure that the Explain is happy and scanning minimum records before handing over the data. But with one of my query, even after adding an appropriate index I was not getting the performance I was expecting. I asked Workbench to explain the query and what? MySQL was not using my newly added index which could optimize the query. I tried FORCE INDEX and MySQL liked it. It started using the index which I forced it to. But I was not happy at forcing MySQL to use my index. I wanted it to do it itself. After researching a bit, I came across STRAIGHT_JOIN and without wasting any time, I added it to my query and what? MySQL started using my index without being forced to. Now the question was, how the STRAIGHT_JOIN works and is different from INNER JOIN. Wit

How to Copy files to remote server using Ant Build

While working on one of the project, I was tired of copying the files manually to remote server using SFTP tools. I was wondering if Ant Builder is able to copy the files from one directory to other, it should also be able to copy to remote server. After googling a bit, I found a bunch of answers, suggestions and finally, it worked for me. The files from my local machine are now getting copied to remote server with Ant Build. I just build my project in Eclipse and files get pushed to the server. The only thing I need to do is; refresh the web page as the server development became the local development for me now. Below are the step-wise instructions to Copy files to remote server using Ant Build: Download jsch.jar 0.1.55 jar. Add jsch.jar 0.1.55 jar to C:\eclipse_folder_path\plugins\org.apache.ant_1.10.8.v20200515-1239\lib folder. Go into the Eclipse Preferences, in the Ant/Runtime entry, in the 'Classpath' tab. Use the button 'Add External Jars' to add your jsch.jar to