adding query limits in database wise