108
Views
6
Comments
Solved
sql advance max record
Question

if i have to return all of the records using sql advance what max record should i put

2021-09-06 15-09-53
Dorine Boudry
 
MVP
Solution

Hi @kean amper ,

agree with several other posts here, that you should really understand why your business doesn't want a max records.  

But if the reasoning is sound (something along the lines of "we believe there will never be very large amounts of records, and it will grow slowly, so even if the number of records gets too large later, there will be plenty of time then to solve any problems that come from retrieving all records"), then I would say, if your aggregate retrieves all records unlimited, then it should reflect so in your code, so leave the MaxRecords empty.

This will make your AI Mentor question your decision, but you can tell it this is a "Won't fix" and you can explain why.  I think that is far superior to just putting some very large number in there to make AI Mentor warnings go away, because what you do then is masque/hide the fact that your query is supposed to be unlimited.  

The reason this type of warning is there, is to make you think about how much records you really need in a single fetch, and remind you of the best practice of limiting it.  If your decision is <all>, man up and leave it empty, don't just pretend to adhere to the best practice by filling in a unrealistically large number.

Dorine

2019-01-31 08-54-57
André Costa
Champion

Hi @kean amper 

The Max Records property in Advanced SQL is limited to an integer value; exceeding this will trigger a warning. The maximum allowable value is 999999999.

However, fetching such a large number of records at once raises a question: what are you trying to achieve? There might be a more efficient way to accomplish your goal without retrieving so many records at once.

AC

2026-02-22 12-17-28
kean amper

Thanks for the quick reply. Max Record data type is integer should i assume this could be max integer value? Its a business requirement to fetch them all they dunno what is the figure so i wanna assume this could be unlimited.


2019-01-31 08-54-57
André Costa
Champion

If you set the Max Records property with a 10-digit number, the SQL will interpret it as a long integer, which triggers a warning. To avoid this, use a 9-digit number as the maximum value.

If even this limit is insufficient, you can implement a workaround: validate whether the Max Records limit was reached and, if so, execute the query again to fetch additional data.

2024-12-18 16-06-42
Junaid Syed

Hello Kean,

Ideally you should not fetch all the records unless you have very concrete reasons for doing so or you are sure that the count of records is not going to grow to an extent that it start causing performance issues.

Having said that, if you are sure that the number of records are not going to grow beyond reasonable number then you already know the max limit for it. However, if you are not sure which seems to be the case here then I would suggest you revisit the use case.

Hope it helps!

Junaid

2024-12-02 13-16-47
Vipin Yadav

Hi @kean amper,

You can create a site property to store the value 999999999. If needed, you can later modify this value from the Service Center. 

Thanks,

Vipin Yadav


2021-09-06 15-09-53
Dorine Boudry
 
MVP
Solution

Hi @kean amper ,

agree with several other posts here, that you should really understand why your business doesn't want a max records.  

But if the reasoning is sound (something along the lines of "we believe there will never be very large amounts of records, and it will grow slowly, so even if the number of records gets too large later, there will be plenty of time then to solve any problems that come from retrieving all records"), then I would say, if your aggregate retrieves all records unlimited, then it should reflect so in your code, so leave the MaxRecords empty.

This will make your AI Mentor question your decision, but you can tell it this is a "Won't fix" and you can explain why.  I think that is far superior to just putting some very large number in there to make AI Mentor warnings go away, because what you do then is masque/hide the fact that your query is supposed to be unlimited.  

The reason this type of warning is there, is to make you think about how much records you really need in a single fetch, and remind you of the best practice of limiting it.  If your decision is <all>, man up and leave it empty, don't just pretend to adhere to the best practice by filling in a unrealistically large number.

Dorine

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.