Fix limit query in memory adapter