Activity Forums Salesforce® Discussions What is the difference between SOSL and SOQL Quires in Saleforce ?

  • Laveena

    Member
    September 17, 2019 at 2:15 pm

    Hi Nikita,

    SOQL in Salesforce:
    soql stands for”Salesforce Object Query Language”.
    It returns Records.
    Records are stores in collection. Records are pertaining to single sObject.
    Search in single sObject and it retains records.
    SOQL retrieves the data from the database using “SELECT” keyword.
    It works on multiple objects at the same time.
    SOQL is not used in Triggers and can be used only in Apex classes and anonymous block.
    SOQL against the same field will be slow.
    SOSL in Salesforce:
    SOSL stands for “Salesforce Object Search language”.
    It returns fields.
    Records are pertaining to different sObjects.
    Search in entire Org and returns fields.
    SOSL retrieves the data from the database using the keyword “FIND“.
    It doesn’t work on multiple objects at the same time and need to write different SOQL queries for different objects.
    SOSL can be used in Triggers and Apex class.
    All fields are already text indexed.

    Thanks

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos