[Feature] Improve memory performance of the `dbt seed` command
- Dominant language
- Rust
- Stars
- 13.8k
- Forks
- 2.6k
- Avg merge
- 21h 31m
- Merged PRs (30d)
- 56
Description
### Is this a new bug in dbt-core?
- [X] I believe this is a new bug in dbt-core
- [X] I have searched the existing issues, and I could not find an existing issue for this bug
### Current Behavior
When I run DBT seed, I have noticed that it uses a very large amount of memory over time. I wonder if there is a memory leak with this functionality. For example, I have a folder containing my seed files, the entire folder is around 125Mb in size. Nothing crazy but a fair amount for seed files.
When I run DBT seed and the command using htop in the terminal it's evident that the command is consuming up to 2Gb of memory to perform this task. I am wondering if this is correct, or if memory isn't being released. I am trying to set kubernetes resources per DAG task and struggle due to the amount of resource this command needs. I have tried this with the latest version of DBT also.
### Expected Behavior
The expected behaviour is difficult, but I guess I would say I'd expect it to consume far less memory than it is consuming. I have noticed the other DBT commands use anywhere from 200Mb up to 400Mb. The difference between these and seed, when there isn't even 130Mb of data seems to high.
### Steps To Reproduce
1. Using:
- dbt-bigQuery version 1.6.7 and dbt-core 1.6.9
- ensure that you have some activity monitor running (top, htop will do)
- set up a DBT project that contains around 130Mb of data across various seed files
2. Run `dbt seed` - locally will be fine
3. Check the new python task being run in top or htop (htop will show you the actual command that initiated it and is a cleaner UI IMO)
4. See the amount of memory being consumed by the process
### Relevant log output
_No response_
### Environment
```markdown
- OS: MacOS Sonoma 14.1.2 (23B92)
- Python: 3.10
- dbt: 1.6.9
```
### Which database adapter are you using with dbt?
bigquery
### Additional Context
Adapter version 1.6.7.
Contributor guide
Assessment
This issue has not been assessed yet.