<@U04S8PLJWMT> I create connection from source Cli...
# ask-ai
а
@kapa.ai I create connection from source Clickhouse and set the state of coursor to value, which take 1200 rows , if I use this value in "where coursor_name > value". But when I starting a sync, I getting an error - OUT of Memory in Clickhouse.Is it true, that Airbyte read all rows in source and apply the filter by coursor after reading full table ? Why it not works ?
k
Based on the information in the knowledge sources, Airbyte source connectors are designed to extract only the delta rows using a SQL query that applies the cursor filter directly in the query, such as:
Copy code
sql select * from table where cursor_field > 'last_sync_max_cursor_field_value'
This means that, in principle, Airbyte should not read the entire table and then filter in memory; instead, it should push down the filter to the database and only fetch the relevant rows. This is the expected behavior for incremental syncs using a cursor field, as documented for the Incremental Append + Deduped sync mode across multiple Airbyte versions [see documentation](https://docs.airbyte.com/platform/using-airbyte/core-concepts/sync-modes/incremental-append-deduped#known-limitations). However, there are several reports of out-of-memory (OOM) errors during syncs with large tables or high row counts, especially when using ClickHouse as a destination. These OOM errors often occur during the normalization step or when handling large result sets, even when the source query should be limited by the cursor filter. For example, users have reported OOM issues with ClickHouse during normalization, even with substantial memory allocated (e.g., 32GB or 64GB RAM), and with relatively moderate data volumes (millions to hundreds of millions of rows) [see issue](https://github.com/airbytehq/airbyte/issues/15352), [see issue](https://github.com/airbytehq/airbyte/issues/33281), [see forum post](https://discuss.airbyte.io/t/3401). There is no explicit evidence in the knowledge sources that Airbyte always reads the full table and applies the filter in memory for ClickHouse sources. The intended behavior is to push down the filter. However, OOM errors can still occur due to: - Inefficient query execution or large result sets being buffered in memory. - The normalization step in ClickHouse, which can be memory-intensive, especially for deduplication or SCD (slowly changing dimension) models. - Java connectors' memory management, which may require tuning environment variables like
JOB_MAIN_CONTAINER_MEMORY_LIMIT
and
JOB_MAIN_CONTAINER_MEMORY_REQUEST
to allocate more memory to the connector process [see forum post](https://discuss.airbyte.io/t/3401). If you are seeing OOM errors even when your cursor filter should limit the result set to 1200 rows, it suggests there may be an issue with how the query is constructed or executed, or with the normalization step in ClickHouse. It is not expected that Airbyte reads the entire table and filters in memory, but practical issues or connector bugs could cause this behavior. Summary: Airbyte is supposed to apply the cursor filter in the source query and only read the relevant rows. If you are experiencing OOM errors with a small result set, it may be due to connector or normalization inefficiencies, not because Airbyte is intentionally reading the full table and filtering in memory. If this persists, it may be worth opening a GitHub issue with detailed logs and configuration for further investigation. If you need to tune memory, refer to the documentation on scaling and configuring connector resources [see scaling guide](https://docs.airbyte.com/operator-guides/scaling-airbyte), [see resource configuration](https://docs.airbyte.com/operator-guides/configuring-connector-resources).
а
@kapa.ai how to check and debug the query, which Airbyte executing for taking an increment &
k
A message from kapa.ai
To check and debug the query that Airbyte executes for incremental syncs, you can inspect the SQL files and logs generated during the sync process. Here’s how you can do it: 1. Find the Job and Attempt IDs: After running a sync, note the job ID and attempt ID from the Airbyte UI. These are needed to locate the relevant files in the Airbyte server container. 2. Access the Airbyte Server Container: Open a bash shell into the Airbyte server Docker container:
Copy code
bash    docker exec -it airbyte-server /bin/bash
3. Locate the SQL File: Use the following command to view the SQL used for normalization (replace
<job_id>
and
<attempt_id>
with your actual values):
Copy code
bash    cat /tmp/workspace/<job_id>/<attempt_id>/build/run/airbyte_utils/models/generated/airbyte_incremental/public/<your_table>.sql
This file contains the SQL Airbyte used to process the incremental data for your table. For example:
Copy code
bash    cat /tmp/workspace/149/0/build/run/airbyte_utils/models/generated/airbyte_incremental/public/table_one.sql
This will show you the SQL query, including how the cursor is applied and how data is selected and transformed during the sync. 4. Check the dbt Log for Temporary Table Creation: To see the SQL for creating temporary tables (which may include the incremental query logic), check the dbt log:
Copy code
bash    cat /tmp/workspace/<job_id>/<attempt_id>/logs/dbt.log
Search for the creation of the relevant temporary table in this log. This process allows you to see exactly what SQL Airbyte is executing for incremental extraction and normalization, which is helpful for debugging and understanding how the cursor is being used in your syncs. [See detailed steps and examples](https://airbyte.com/tutorials/incremental-data-synchronization#step-7).
а
@kapa.ai I have only container airbyte-abctl-control-plane and there no directory /tmp/workspace/
k
A message from kapa.ai
If you only have the
airbyte-abctl-control-plane
container and do not see the
/tmp/workspace/
directory, this is expected in certain Airbyte deployments—especially on Kubernetes. According to the knowledge sources, the
/tmp/workspace/
directory is typically present in the Airbyte server or normalization containers during a sync job, but these directories are often ephemeral and only exist for the life of the job. In Kubernetes deployments, these files are not persisted after the job completes, and you cannot access them from the control plane container after the job has finished. This limitation is confirmed in the Airbyte community and official responses: - On Kubernetes, the
/tmp/workspace/
directory is present only in the normalization job pods, and those volumes are ephemeral. There is no way to look at the generated files later, and you cannot change the volume configuration to persist them with config files, as the volumes are configured inside the Java code. This is a known limitation of Airbyte on Kubernetes deployments, and there are open feature requests to address it ([see discussion](https://discuss.airbyte.io/t/2013), [see issue](https://github.com/airbytehq/airbyte/issues/8090)). Summary: If you are running Airbyte on Kubernetes and only have access to the
airbyte-abctl-control-plane
container, you will not be able to access the
/tmp/workspace/
directory or the SQL/log files after the job completes. This is a current limitation of Airbyte's Kubernetes deployment model, and there is no supported workaround to persist or access these files post-job at this time. If you need to debug the queries or normalization logic, you would need to capture the files/logs during the job's execution, or consider running Airbyte in a Docker deployment where these files are accessible after the job completes.