support MaxScan in queries