1. Database.query() retrives 50K records where as Database.getQueryLocator() retrives 50 million records from Database. 2. Database.query() is used to construct dynamic query instead of using SOQL query where as Database.getQueryLocator() is the return type of start method of a Batch class.

via Difference between Database.query() and Database.getQueryLocator() — Rahul Yadavansh

Advertisements