# CoherenceLiveQuery

**CoherenceLiveQuery** is a component used to create an [area of interest](https://docs.coherence.io/1.8/manual/optimization/areas-of-interest), that is, an area of the world that the Client is interested in for the purpose of network traffic.

{% hint style="warning" %}
Having **at least one query** in the scene **is necessary** to receive any network update!
{% endhint %}

### Adding a LiveQuery to the scene

<figure><img src="https://1022088114-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fxvd5c9jwOH7YkKEUSqJD%2Fuploads%2FXLS14wbX2yvnAKfPjZat%2Fimage.png?alt=media&#x26;token=d1c3604a-ad97-4556-8362-77eb77ceb4ed" alt=""><figcaption></figcaption></figure>

A LiveQuery defines the area of interest. It is defined by its Transform's position, its **extent** (half the side of the cube) and also a buffer to the extent (see [Hysteresis](#hysteresis)).

<figure><img src="https://1022088114-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fxvd5c9jwOH7YkKEUSqJD%2Fuploads%2FW6JEfKjYmEcaDAluy9Fw%2Fimg-2025-06-11-11-17-50.png?alt=media&#x26;token=a3f74037-0f8a-45fb-84cf-f0ab6113f691" alt=""><figcaption><p>CoherenceLiveQuery component</p></figcaption></figure>

There can be multiple LiveQueries in a single scene.

{% hint style="info" %}
Working with multiple LiveQueries is an **additive** operation and not a subtractive one.
{% endhint %}

### Moving a LiveQuery

A common approach is to place a CoherenceLiveQuery component on the camera and adjust the extent to reach as far as the far clipping plane or visibility distance.

Moving the GameObject containing the LiveQuery notifies the Replication Server that the query for that particular client has moved.

### Hysteresis

When an entity moves near the edge of a LiveQuery extent, it might rapidly enter and exit the query. This can cause frequent create and destroy events, which may lead to performance degradation.

To avoid this, you can increase the **buffer** field on the LiveQuery. An entity is only removed from the query after it moves outside the query's extent **plus the buffer**. But to be added to the LiveQuery, it must enter the query's extent without the buffer.

The buffer field can also be changed during the runtime, and the Replication Server will be notified of it changing.

### Limits

The Replication Server imposes limits on number of queries a Client can create. Read more about it in the [Replication Server](https://docs.coherence.io/1.8/replication-server#maximum-query-count-per-client) section.

{% hint style="success" %}
**Try it out yourself**

Go to our [First Steps](https://coherence.io/games/coherence/first-steps-tutorial) interactive demo and see it in action in scene 3 (Areas of Interest). There is also has an [accompanying explanation](https://docs.coherence.io/1.8/getting-started/samples-and-tutorials/first-steps-tutorial/3-spatial-partitioning) for the curious.
{% endhint %}
