I am running two jobs for Bulk API on FieldPermissions:

Job 1:

SELECT Id, ParentId, SobjectType, Field, PermissionsEdit, PermissionsRead, SystemModstamp FROM FieldPermissions WHERE SystemModstamp <= 2017-05-15T19:58:37Z

Job 2:

SELECT Id FROM FieldPermissions WHERE SystemModstamp <= 2017-05-15T20:30:28Z

Job 1 ran within 15 seconds while Job 2 is slow and running for about half an hour. Same set of job properties that is queried but I don't see why this is taking so long. Tried with SOAP API too for which the query on Job2 is really slow. How to speed up the SOQL on Job 2?

  • Is this a repeatable phenomenon? Seems like just a one-off. – Adrian Larson May 15 '17 at 22:27
  • 1
    Potential duplicate of Query on FieldPermissions object is super slow. You need to include one of the indexed fields SobjectType, Field, or PermissionsRead – Daniel Ballinger May 16 '17 at 0:01
  • @DanielBallinger Wrong! Querying on Id alone with SystemModStamp is on the indexed field and the plan does not yield any warnings. Using PermissionsRead in the where clause would give the warning for unindexed field. – dmachop Aug 14 '18 at 20:26
  • @dmachop I am seeing the Index on SystemModstamp. Oddly, the TableScan is coming up first in the Query Plan. If so, that would certainly explain whey the query is so slow. Can you check what your query plan comes up with. – Daniel Ballinger Aug 15 '18 at 1:36
  • @DanielBallinger Same query plan. It's odd as it is stuck only for FieldPermissions. – dmachop Aug 15 '18 at 14:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.