Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgres Truncate Query Takes Longer Than Psycopg #201

Open
2 tasks done
arunksoman opened this issue Mar 25, 2024 · 0 comments
Open
2 tasks done

Postgres Truncate Query Takes Longer Than Psycopg #201

arunksoman opened this issue Mar 25, 2024 · 0 comments

Comments

@arunksoman
Copy link

What happens?

I tried to truncate a large table with both psycopg and duckdb_postgres_scanner. Psycopg is truncating table instantly. Duckdb postgres scanner takes long time than psycopg (about 20-30 minute). I believe duckdb is handling transaction and hence it is taking longer. Is there any parameter I can pass to avoid handling transaction by postgres extension while executing query? I didn't found anything on the documentation.

To Reproduce

import duckdb
import config

conn = duckdb.connect(":memory:")
conn.execute(
            f"ATTACH 'dbname={config.DB_NAME} user={config.DB_USER} password={config.DB_PASSWORD} hostaddr={config.DB_HOST}' AS pg_db (TYPE postgres);"
        )
conn.execute("TRUNCATE table pg_db.large_table")

OS:

Windows

PostgreSQL Version:

14.5

DuckDB Version:

0.10.1

DuckDB Client:

Python

Full Name:

Arun K Soman

Affiliation:

Nothing

Have you tried this on the latest main branch?

  • I agree

Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?

  • I agree
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant