Issue in Redash self hosted


I am using self hosted Redash. I am using 16GB Memory there. I put a query on Redash using Redshift.I got Memory exaust error.When I check on server, there is 10GB free memory.When I start query execution.Memory goes decrease and goes around 168MB and got error, and its takes around 5 minutes.When i run same query on Redshift.Output comes within 50 Second with 100MB import csv file.Query output is 1.27 Lakh Rows. I am using m4.xlarge instance of AWS.

Please help me in following:-

  1. why Redash Taking so much time to show query Result when its data comes within seconds in Redshift.(Its happen with maximun all queries)
  2. How I can resolve same Memory issue.