أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.
make sure you have enough hardware power!
BUT the most important thing is to tune up the database.
try to understand your query, sometimes you need to re-write it to optimize it
you need to look at the execution plan and find where it's getting heavy, usually a full table scan cause the heavy work, you can create an index make sure to use sorting on the final stage, as sorting in the middle of a complex query is a bad idea.