@Ron_Grove (Ron_Grove) posted a new topic, subject "Any way to put a lid on ODATA queries?". It read:

   I have a customer with about 330,000 records in their orders table. I was thinking about providing ODATA access, but it doesn't look too safe. http://localhost:8099/odata/orders will keep going up to 2GB of memory for the server and then die with an out of memory error. I've never actually deployed an ODATA service with DA, just played with it, so I'm curious how I would implement defensive programming with it.
    
    Thank you,  
    Ron

Then @Ron_Grove (Ron_Grove) said

    I suppose I could put a TOP command in the SQL rather than let AutoSQL do it for me. Are others here doing that too? I suppose it hasn't been too much of an issue thus far because I've had my GUI restrict people from going crazy. I'm feeling a little uncomfortable at the thought of an end user with PowerPivot going crazy on an OData service, though.

So @valeriy (valeriy) replied

    Property MaxRecords of ODATA schema dispatcher component handles this. Set it to limit number of records per request (-1 for unlimited). Unfortunately, there is a small bug I've just found testing this answer.  
    If you are using Delphi, you could fix it yourself:  
    uDAODataDispatcher.pas
    
    // lSimpleRequest.MaxRecords := -1;  
    lSimpleRequest.MaxRecords := MaxRecords; //fix  
    lSimpleRequestArr.Add(lSimpleRequest);
    [code] 
          if not VarIsNull(lQuery.Top) then
            lSimpleRequest.MaxRecords := Min(lQuery.Top, MaxRecords);
        
    [/code]
    
    .NET version will be fixed as soon as possible.  
    logged as:  
    52312: DA/D ODATAShemaDispatcher.MaxRecords doesn't have an effect  
    52313: OData: Query.Top value is always overridded by Query.MaxRecords

@EvgenyK (Evgeny Karpov) replied

    A post was split to a new topic: OData: issue with MaxRecords


{'source': 'discourse', 'url': 'https://talk.remobjects.com/t/any-way-to-put-a-lid-on-odata-queries/423', 'title': 'Any way to put a lid on ODATA queries?', 'views': 433, 'has_accepted_answer': False, 'word_count': 319, 'like_count': 0, 'reply_count': 1, 'participant_count': 2, 'posts': 4, 'tags': '', 'author': '@Ron_Grove (Ron_Grove)', 'participants': '@Ron_Grove (Ron_Grove), @valeriy (valeriy), @EvgenyK (Evgeny Karpov)', 'image_url': [None], 'created_at': '2021-09-30T22:00:00.000Z', 'last_posted_at': '2021-11-23T21:04:08.452Z'}