Maximum number of records returned using query?

miro2
Mega Sage

Hi community,

 

What is the maximum number of records returned when we query a table?

I found this article that says the database view is limited to 10001 records.

How does it looks like for any other tables?

 

Scenario:
I will query the staging table and push the records into the array (only one field from record will be stored in array). For example, if 20000 records are fetched from the integration, will all the records be queried by GlideRecord?

 

 

1 ACCEPTED SOLUTION

Swarup Patra
Kilo Guru

The maximum number of records that can be returned when querying a table in ServiceNow is determined by the system property 'glide.db.max_view_records'. By default, this property is set to 10,000 records. However, this limit can be increased or decreased by modifying the system property.

Here are the key points:

- The system property 'glide.db.max_view_records' controls the maximum number of records returned from a database view.
- By default, this property is set to 10,000 records.
- This limit applies to all tables in ServiceNow, not just database views.
- The limit can be increased or decreased by modifying the system property.
- However, increasing the limit may impact system performance.
- It's recommended to use pagination or filtering to manage large data sets.
- If a query exceeds this limit, only the first 10,000 records will be returned.
- The remaining records can be accessed by running additional queries.


nowKB.com
If you want to know any information about Service Now . Visit to https://nowkb.com/home

View solution in original post

4 REPLIES 4

Swarup Patra
Kilo Guru

The maximum number of records that can be returned when querying a table in ServiceNow is determined by the system property 'glide.db.max_view_records'. By default, this property is set to 10,000 records. However, this limit can be increased or decreased by modifying the system property.

Here are the key points:

- The system property 'glide.db.max_view_records' controls the maximum number of records returned from a database view.
- By default, this property is set to 10,000 records.
- This limit applies to all tables in ServiceNow, not just database views.
- The limit can be increased or decreased by modifying the system property.
- However, increasing the limit may impact system performance.
- It's recommended to use pagination or filtering to manage large data sets.
- If a query exceeds this limit, only the first 10,000 records will be returned.
- The remaining records can be accessed by running additional queries.


nowKB.com
If you want to know any information about Service Now . Visit to https://nowkb.com/home

hi @Swarup Patra 

is this applicable without database view?  

I tried to create glide.db.max_view_records property and limit the value to 5 or 6 for testing, this change is not reflecting there. 

Kindly let me know on this. 

Do you have any source for the system property affecting all tables? All the documentation I've found states the exact opposite (e.g. https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0855795), and it certainly doesn't seem to be working for anyone who's tried it (e.g, https://www.servicenow.com/community/developer-forum/how-can-i-limit-the-number-of-records-returned-... and Manu4 in this thread).

Manu4
Tera Contributor

@Swarup Patra @miro2 

Is this applicable to table irrespective of database view also. 

I tried creating glide.db.max_view_records property limiting the value to 5 or 6 records for testing, it is not reflecting there, it is querying more than 30 records also. 

Kindly update me on how to test it