Differences chooseWindow and setLimit in the GlideAggregate ImplementationSummaryExample Script: We have a table where we can have multiple records for each user. We want to implement pagination based on users. Our query would be similar to below one : var gr = new GlideAggregate('incident');gr.addQuery('caller_id', '');gr.chooseWindow(0, 5);gr.groupBy('assigned_to');gr.orderBy('assigned_to');gr.query();return gr; This query is working fine but it is returning 6 records where as similar query using GlideRecord gives only 5 records. Is chooseWindow supported by glideAggregate? Calling chooseWindow would not optimise the query performance since we are retrieving all records when querying the database. We have identified this issue as a bug as per PRB1306938 - chooseWindow in GlideAggregate is not working similar to GlideRecord This PRB has been closed as a "Won't Fix" because the attempt to change the behavior can result in breaking existing functionalities (multiple test failures). Note: setLimit internally calls chooseWindow. Prior to New York calling setLimit on GlideAggregate would not apply the specified limit, as essentially GlideAggregate overrode the setLimit behaviour from GlideRecord, which it extends. However, from Orlando this changed and calling setLimit on a GlideAggregate would set the limit and therefore then encountered the same problem described earlier in this article.