I know that MongoDB will use available free memory for caching, and swap to disk as needed to yield memory to other applications on the same server. For the best performance you'll want to have enough RAM to keep your indices and frequently used data ("working set") in memory.
So let's assume that I have 1 GB of data in MySQL which took 5 GB of disk space when it restored in MongoDB. Currently I have 2 GB of RAM, when we run analytic queries, MongoDb took 6 times more than the excecution time in MySql.
As my "working Set" is around 500MB and 1GB free RAM on my Machine instead of that query performance is very poor than MySQL so that I am a bit confused about how to calculate how much RAM I need to run analytic queries in MongoDB so that query execution time could be better than MySql.