![]() |
Google Ads API Team |
[2025-08-29 18:42:39Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01u5Uw5:ref" (ADR-00331366)
Hi,
Please note that you can't get a row count before a GAQL search using a COUNT() function like you would in SQL. It's not a supported feature, and it's not possible to submit a feature request for it.
However, you can use the return_total_results_count field to get a similar result. By setting this field to True in your search request, the Google Ads API will return the total number of rows that match your query, regardless of any LIMIT clause. This field is set to False by default.
![]() |
Google Ads API Team |
[2025-09-01 06:07:40Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01u5Uw5:ref" (ADR-00331366)
Thanks for the excellent answer!
This is the solution I was looking for. A thing like that is necessary to avoid buffer overruns, memory exhaustion etc.
However, in my personal repository I will extend my GAQL parser for transpiling a corresponding COUNT clause into the SearchSettings option you described.
Best regards
Hi,
I couldn't find an example on how to apply the SearchSettings object in a GAQL query in the documentation.
How can I apply this setting to SearchStreamAsync?
Your answer is appreciated.
Regards
POST https://googleads.googleapis.com/v21/customers/xxxxxxxxxx/googleAds:search?key=[YOUR_API_KEY] HTTP/1.1 developer-token: ********************** Authorization: Bearer [YOUR_ACCESS_TOKEN] Accept: application/json Content-Type: application/json { "query": "SELECT ad_group.id, geographic_view.country_criterion_id, geographic_view.location_type, campaign.id, ad_group.id, segments.device, segments.ad_network_type, metrics.clicks, metrics.cost_micros, metrics.impressions, campaign.advertising_channel_type FROM geographic_view", "searchSettings": { "returnTotalResultsCount": true } }
It's also important to note that it's not possible to apply SearchSettings in the SearchStream method, as this method will have SummaryRowSetting with different enum values compared to the Search method.
I hope this clarifies. Feel free to get back to us if you have any further questions.![]() |
Google Ads API Team |
[2025-09-01 18:44:24Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01u5Uw5:ref" (ADR-00331366)
Hi,
thank for you for clarifying.
I tried using the suggested SearchSettings object, but I'm not getting any result from the SearchAsync() method.
I'm using the Google Ads .NET client library. Should I file a bug report there?
Your answer is appreciated.
![]() |
Google Ads API Team |
[2025-09-02 19:46:38Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01u5Uw5:ref" (ADR-00331366)
Hi,
thanks again for your answer.
In the meantime, I created a bug report on GitHub for the Google Ads .NET team
https://github.com/googleads/google-ads-dotnet/issues/617
I guess this is an inherent issue with the Google Ads client implementation generator: There's simply no corresponding return value implemented in the client libraries. So, the issue may eventually be forwarded to the protocolbuffers/protobuf team.
Perhaps there's a special method for retrieving the Total Expected Rows Count value somewhere. But we'll have to await the progress of that bug report.
Best regards