---
title: "Comparision between SOSL and SOQL in Salesforce?"  
description: "Comparision between SOSL and SOQL in Salesforce?"  
author: "Vihaan rai"  
published: 2018-02-02  
canonical: https://answers.mindstick.com/qa/33949/comparision-between-sosl-and-soql-in-salesforce  
category: "salesforce"  
tags: ["sosl", "soql", "salesforce"]  
reading_time: 2 minutes  

---

# Comparision between SOSL and SOQL in Salesforce?

Comparision between [SOSL](https://answers.mindstick.com/qa/33780/what-is-sosl-in-salesforce) and [SOQL](https://answers.mindstick.com/qa/33781/what-is-soql-in-salesforce) in [Salesforce](https://yourviews.mindstick.com/view/82645/what-you-need-to-know-to-get-started-on-salesforce-field-service)?

## Answers

### Answer by Tarun Gautam

## I have listed some of the comparisons between SOQL and SOSL:

| **SOQL** | **SOSL** |
| --- | --- |
| Using SOQL, we search against the org’s database. | Using SOSL, we don’t know in which object or field the data resides. |
| The results after searching the data include matches for the exact search string. | We can find object or field in the most efficient and fastest way possible. |
| Using SOQL, we know in which objects or fields the data resides. | We can fetch data for a specific term which we know exists within a field because SOSL can tokenize multiple terms within a field and build a search index for this. |
| Using SOQL, we can search at a time only one object. | SOSL query can search many objects at a time. |
| Using SOQL, we can fetch all fields with any type of datatypes. | Using SOSL, we can search the only datatype of text, phone, and email type records. |
| SOQL is used in Triggers and classes. | In SOSL, classes are used but Triggers are not in use. |
| SOQL query performs DML operations on query results. | Using SOSL query, DML operations are not allowed. |
| We can fetch data from single or multiple objects which are related to one another. | SOSL searches are faster and can return more relevant results. |
| We can count the number of records that meet specified criteria. | Depending on the search object, SOSL searches also take advantage of the advanced features of the search index. |
| We can get sorted results as part of the query. | We can fetch multiple objects and fields that might or might not be related to one another comfortably. |
| We can fetch data from number, date, or checkbox fields. | We can fetch data for a particular division and find it in the most efficient way possible in an org using the divisions' feature. |


---

Original Source: https://answers.mindstick.com/qa/33949/comparision-between-sosl-and-soql-in-salesforce

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
