---
schema_version: "1"
id: f688ba4afff0629262cb036670c43a17172ed1248c86a17da6dbb212ba802ab4
title: Connection and Performance Optimization in DirectConnect Data Streams
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/mktg/264-0-0/dato_data_streams_direct_connection.md
canonical_url: https://help.salesforce.com/s/articleView?id=mktg.dato_data_streams_direct_connection.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: f5645c7ee65c3e5a0e6e52595bc02042c21ff07b6a8affac9a7ee601ff266482
description: Setting up a DirectConnect data stream establishes a real-time connection to your database. Each time an entity that uses dimensions or measurements sourced from DirectConnect is loaded, your database is queried in real time. A real-time connection can potentially result in many calls being made to your database concurrently, leading to slower performance and exceeding rate limits.
products:
  - Marketing
  - Marketing Cloud Intelligence
release: "264"
---
# Connection and Performance Optimization in DirectConnect Data Streams

Setting up a DirectConnect data stream establishes a real-time connection to your database. Each time an entity that uses dimensions or measurements sourced from DirectConnect is loaded, your database is queried in real time. A real-time connection can potentially result in many calls being made to your database concurrently, leading to slower performance and exceeding rate limits.

Use the data stream’s cache functionality to improve performance and temporarily save each query result for the defined cache duration. Whenever you load the same entity, the data is retrieved from the cache, rather than making an additional call to the external database.

Salesforce recommends setting the cache duration based on how frequently your database is updated. For example, set the cache duration to 20 minutes if the database updates every 20 minutes. Setting to any amount of time less than 20 minutes, can result in no data retrieval.

![caching duration](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-mktg-salesforce_datorama-264-0-0-production-enus/d38a342d-dd4a-4af8-8343-f372280a75dd/salesforce_datorama/images/data/data_streams_direct.png)