> ## Documentation Index
> Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Cube.shared_context

> *getter* Cube.shared\_context: [MutableMapping](https://docs.python.org/3/library/collections.abc.html#collections.abc.MutableMapping)\[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [bool](https://docs.python.org/3/builtins/functions.html#bool) | [int](https://docs.python.org/3/builtins/functions.html#int) | [float](https://docs.python.org/3/builtins/functions.html#float) | [str](https://docs.python.org/3/builtins/stdtypes.html#str)]

Context values shared by all the users.

Context values can also be set at query time, and per user, directly from the UI.
The values in the shared context are the default ones for all the users.

* `queriesTimeLimit`

  The number of seconds after which a running query is cancelled and its resources reclaimed.
  Set to `-1` to remove the limit.
* `queriesTimeLimit.max`

  The maximum `queriesTimeLimit` (in seconds) a user is allowed to set.
  A request above it is silently clamped down to it.
  It must be strictly positive and cannot be lower than `queriesTimeLimit` when that one is defined.
  When set on its own, it also becomes the default `queriesTimeLimit`.
  Leave it unset to impose no ceiling.
* `queriesResultLimit.intermediateLimit`

  The limit number of point locations for a single intermediate result, that is the result of one retrieval for one partition.
  This works as a safe-guard to prevent queries from consuming too much memory, which is especially useful when going to production with several simultaneous users on the same server.
  Reaching it means a single retrieval is too wide on its own.
  Defaults to `1_000_000`.
  Set to `-1` to remove the limit.
  See the [Atoti Server docs](https://docs.activeviam.com/engine/java-sdk/6.2/monitoring/monitoring_query_execution.md) for what a point location is, and for how to measure the values to give to both limits.
* `queriesResultLimit.transientLimit`

  Similar to *intermediateLimit* but across all the intermediate results of the same query.
  Reaching it means the query as a whole is too large, even when no single intermediate result came close to *intermediateLimit*.
  Defaults to `10_000_000`.
  Since a cube always carries both values, raising *intermediateLimit* above this one does not raise it too: this limit remains the effective cap on the query.
  Set to `-1` to remove the limit.
* `queryExecution.disableRangeSharing`
  > Range sharing can be disabled to prevent heap memory overuse.
  > Range sharing is used when multiple queries with overlapping locations are executed concurrently.

```pycon theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
>>> import pprint
>>> df = pd.DataFrame(
...     columns=["City", "Price"],
...     data=[
...         ("London", 240.0),
...         ("New York", 270.0),
...         ("Paris", 200.0),
...     ],
... )
>>> table = session.read_pandas(
...     df,
...     keys={"City"},
...     table_name="shared_context example",
... )
>>> cube = session.create_cube(table)
>>> pprint.pp({**cube.shared_context})
{'queriesResultLimit.intermediateLimit': '1000000',
 'queriesResultLimit.transientLimit': '10000000',
 'queriesTimeLimit': '30',
 'queryExecution.disableRangeSharing': 'false'}
>>> cube.shared_context["queriesTimeLimit"] = 60
>>> cube.shared_context["queriesResultLimit.intermediateLimit"] = 5_000_000
>>> cube.shared_context["queriesResultLimit.transientLimit"] = 50_000_000
>>> cube.shared_context["queryExecution.disableRangeSharing"] = True
>>> pprint.pp({**cube.shared_context})
{'queriesResultLimit.intermediateLimit': '5000000',
 'queriesResultLimit.transientLimit': '50000000',
 'queriesTimeLimit': '60',
 'queryExecution.disableRangeSharing': 'true'}
```
