OI OData protects the server with a few limits. This page explains what they are, how they affect datasets, and how to write queries that stay fast on large systems.
Limits at a glance
| Limit | Value | Applies to |
|---|---|---|
| Rows per response | 1,000 | Every object. Larger results are split into pages. Union and $crossjoin return up to 5,000 rows in one response, and reject a larger result. |
| Rows in a dataset | 1,000 | OI OData datasets read one response only |
Maximum $top |
1,000 | Every object. The top of Union and $crossjoin isn't limited to 1,000. |
| Fetch cap | 5,000 rows | Live objects. $count and apply on one with more than 5,000 rows are rejected |
| Paging depth | 100,000 rows | Live objects: $skip plus $top without a $filter can't reach further. Add a $filter. |
| Result cap | 5,000 rows | Union and $crossjoin: a larger result is rejected, with or without $skip and $orderby |
Objects in a $crossjoin |
3 | Each object only once |
| Expand depth | 1 to 6 levels, depending on the object | $expand |
| Request timeout | The datasource's Request Timeout (1 minute by default) | OI OData datasets |
| Database query timeout | 30 seconds | Every SQL query the service runs |
The 1,000-row dataset limit
The OData service returns results in pages of up to 1,000 rows. The OI OData Adaptor reads the first page only, so a dataset holds at most 1,000 rows. If more rows match, the rest are left out without a warning.
To stay under the limit:
- Filter to the rows the page needs, using parameters for dates and assets.
- Aggregate on the server with
$apply. A summary rarely needs 1,000 rows. - Use
$topwith$orderbyfor "top N" or "most recent N" lists, so you know which rows you get.
Tip: Make it obvious when a list is cut off. Use $orderby with $top=1000 so the page always shows the newest or largest rows, and tell users in the page title, for example "Latest 1,000 events".
The 5,000-row fetch cap
On live objects, Explorer reads at most 5,000 source rows before it applies $filter, $orderby, $apply and $count:
Templates, Attributes, AttributeValues, Tags, Calculations, SapiCases, SapiIssues, SapiSummaries, SapiTimeWindows, SapiComments, LogSheets, LogSheetRows
On a system with more than 5,000 tags, Tags?$filter=contains(Name,'FlowRate') only searches the first 5,000. Some matching tags can be missed.
Union and $crossjoin apply their cap after filtering instead, and reject a result over it with an error, so narrowing the query always helps. LastEntryPerWorkbook returns every matching row.
A count ($count=true) or an aggregation (apply) over part of the data would be wrong, so on a live object with more than 5,000 rows they are rejected with "Bad Request" and a message pointing to the database-backed object. When rows are left out of a filtered or sorted result, the response carries the header X-Result-Truncated: 5000, and the body an @Ifs.OI.truncated: true annotation. Datasets don't show this header. Check a query in a browser's developer tools, or use a database-backed object to avoid the cap altogether.
Exception: on LogSheetRows, filters on LogSheetName and Timestamp joined with and run in the database before the cap. Always filter log sheet readings by sheet and time first.
Expand depth
$expand isn't used in datasets, but in a browser, Excel or Power BI, each object has a maximum nesting depth:
| Depth | Objects |
|---|---|
| 6 | Forms |
| 4 | Entities |
| 3 | EntityMetadata, SapiCases, SapiIssues, SapiSummaries, SapiTimeWindows, Templates, Hierarchies, TemplateInstances, AttributeValueInstances, LogSheets |
| 2 | Attributes, and every object not listed here |
| 1 | AttributeValues |
Deeper requests are rejected.
Timeouts
An OI OData dataset must finish within its datasource's Request Timeout, which is 1 minute by default. To change it, edit the datasource in Core Management. Each database query also stops after 30 seconds, so a longer Request Timeout doesn't help a slow SQL query.
Queries that take a long time are usually filtering or grouping a live object over many rows, or reading many live data-entry fields. The fixes below help more than a longer timeout.
Choosing the right object
If you need to search, count or group across a large volume, use the database-backed equivalent. Filtering and grouping run in SQL with no 5,000-row cap, and you can use the OI query functions.
| Instead of | Use |
|---|---|
Templates |
TemplateDefinitions |
Tags |
TagDefinitions |
Calculations |
Datasets |
SapiCases, SapiIssues, SapiSummaries, SapiTimeWindows (for counts) |
EntryRecords, EntryForms |
To find assets by a Metadata Field, use Entities or EntityMetadata. On a very large asset model, match on the field's typed column, such as ValueUniqueString, rather than on Value. The typed column is indexed. See Metadata.
Performance checklist
- Use
$select. Return only the columns the page uses. - Filter first. In
$apply, putfilter(...)beforecomputeandgroupby. - Aggregate on the server instead of returning raw rows for a chart to count.
- Use database-backed objects for search, counts and trends.
- Filter entries on saved fields. On
SapiCases,SapiIssues,SapiSummariesandSapiTimeWindows, filtering or sorting on a live data-entry field reads live values for every fetched entry. See Entries. - Prefer
startswithtocontainson large text searches where you can. - Avoid unbounded queries. Always use a time window on event objects such as
AnalyticsEvents,SentinelEventsandEntryAuditLogs.
Using OI OData outside datasets
The 1,000-row dataset limit only applies to the OI OData Adaptor. Excel, Power BI and most OData libraries follow the @odata.nextLink in each response and read every page automatically.
https://<your-oi-server>/<service-root>/odata/TagDefinitions?$select=Name,NativeName,Description
In Power BI or Excel, choose Get Data ▸ OData Feed and paste the full URL.
Calling OI OData from Python:
import requests
BASE = "https://oi.example.com/oi.core/odata"
session = requests.Session()
session.auth = ... # your organisation's sign-in method (ask your OI administrator)
def odata_get(path, **params):
url, rows = f"{BASE}/{path}", []
while url:
r = session.get(url, params=params)
r.raise_for_status()
if r.headers.get("X-Result-Truncated"):
print("Warning: result truncated - consider the database-backed object")
body = r.json()
rows += body["value"]
url, params = body.get("@odata.nextLink"), None
return rows
wells = odata_get("Entities", **{"$filter": "startswith(Name,'WELL-')", "$select": "Name,LastModified"})