본문 바로가기

Salesforce

Indexes

Indexes

  1. Standard
    • RecordTypeId
    • Division
    • CreatedDate
    • Systemmodstamp (LastModifiedDate)
    • Name
    • Email ( for contacts and leads)
    • Foreign key relationships (lookups and maser-detail)
    • The unique Salesforce record ID, which is the primary key for each object
  2. Custom
    • External Id(외부 아이디) [외부 아이디를 생성할 수 있는 필드들]
      • Auto Number
      • Email
      • Number
      • Text

Tip. External Id로도 DML이 가능하다! 원래라면 List에 담아서 한번에 insert, update, upsert...등등 했겠지만! External Id를 알고 있다면 update ListName ExternalId; 이런식으로 하면됨. ExternalId에는 External Id로 지정된 API명을 입력해주면 된다.

 

****index로 사용할 수 없는 custom field

  1. multi-select picklists
  2. text areas (long)
  3. text areas (rich)
  4. non-deterministic formula fields (비결정론적 수식 필드)
  5. encrypted text field (암호화 된 텍스트 필드)

Indexing with Nulls

대용량 데이터를 처리할 때 인덱스를 사용해 null인 필드를 가진 레코드를 먼저 걸러내는 작업을 할 수 있다.
참고( https://developer.salesforce.com/docs/atlas.en-us.salesforce_large_data_volumes_bp.meta/salesforce_large_data_volumes_bp/ldv_deployments_case_studies_indexing_with_nulls.htm)

SELECT Name
FROM Object
WHERE Status__c = ''   ← 이런 쿼리를 사용하면 인덱스가 사용이 안된다.

그래서, Status_Value__c = IF(ISBLANK(Status__c), "blank", Status__c) 와 같은 작업을 해주고

SELECT Name
FROM Object
*WHERE Status_Value__c = 'blank'*   ← 이런식으로 사용이 가능하다!

참고로, 여러 개 필드에도 적용 가능함.

'Salesforce' 카테고리의 다른 글

Page to Page 로 attribute 보내는 법! (AURA<-> AURA)  (0) 2021.10.08
Partner 사이트에서 custom object가 안보일 때 확인해야 할 사항  (0) 2021.10.08
SFDC File System  (0) 2021.09.30
APEX TESTING  (0) 2021.09.30
APEX TRIGGER  (0) 2021.09.30