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

sql: DELETE always reports actual row count: 1 in EXPLAIN ANALYZE #138971

Closed
yuzefovich opened this issue Jan 13, 2025 · 1 comment · Fixed by #139278
Closed

sql: DELETE always reports actual row count: 1 in EXPLAIN ANALYZE #138971

yuzefovich opened this issue Jan 13, 2025 · 1 comment · Fixed by #139278
Assignees
Labels
A-sql-explain Issues related to EXPLAIN and EXPLAIN ANALYZE improvements branch-release-25.1 C-cleanup Tech debt, refactors, loose ends, etc. Solution not expected to significantly change behavior. E-quick-win Likely to be a quick win for someone experienced. T-sql-queries SQL Queries Team

Comments

@yuzefovich
Copy link
Member

yuzefovich commented Jan 13, 2025

I think regardless of how many rows are deleted by the DELETE stmt, we seem to always say actual row count: 1 in EXPLAIN ANALYZE. A couple of examples:

-- empty table
CREATE TABLE t (k INT PRIMARY KEY);
EXPLAIN ANALYZE DELETE FROM t WHERE k = 1 OR k = 2;
EXPLAIN ANALYZE DELETE FROM t WHERE k > 100;
-- empty table
CREATE TABLE t (k INT PRIMARY KEY, v INT);
EXPLAIN ANALYZE DELETE FROM t WHERE v % 2 = 0;
-- some rows are deleted
CREATE TABLE t (k INT PRIMARY KEY);
INSERT INTO t SELECT generate_series(1, 1000);
EXPLAIN ANALYZE DELETE FROM t WHERE k = 1 OR k = 2;
EXPLAIN ANALYZE DELETE FROM t WHERE k > 100;
CREATE TABLE t (k INT PRIMARY KEY, v INT);
INSERT INTO t SELECT i, i FROM generate_series(1, 1000) AS g(i);
EXPLAIN ANALYZE DELETE FROM t WHERE v % 2 = 0;

Jira issue: CRDB-46443

@yuzefovich yuzefovich added A-sql-explain Issues related to EXPLAIN and EXPLAIN ANALYZE improvements C-cleanup Tech debt, refactors, loose ends, etc. Solution not expected to significantly change behavior. T-sql-queries SQL Queries Team labels Jan 13, 2025
@github-project-automation github-project-automation bot moved this to Triage in SQL Queries Jan 13, 2025
@yuzefovich yuzefovich added the E-quick-win Likely to be a quick win for someone experienced. label Jan 13, 2025
@yuzefovich yuzefovich moved this from Triage to Bugs to Fix in SQL Queries Jan 13, 2025
@yuzefovich yuzefovich self-assigned this Jan 16, 2025
@yuzefovich yuzefovich moved this from Bugs to Fix to Active in SQL Queries Jan 16, 2025
@craig craig bot closed this as completed in c291e10 Jan 17, 2025
@github-project-automation github-project-automation bot moved this from Active to Done in SQL Queries Jan 17, 2025
Copy link

blathers-crl bot commented Jan 17, 2025

Based on the specified backports for linked PR #139278, I applied the following new label(s) to this issue: branch-release-25.1. Please adjust the labels as needed to match the branches actually affected by this issue, including adding any known older branches.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sql-explain Issues related to EXPLAIN and EXPLAIN ANALYZE improvements branch-release-25.1 C-cleanup Tech debt, refactors, loose ends, etc. Solution not expected to significantly change behavior. E-quick-win Likely to be a quick win for someone experienced. T-sql-queries SQL Queries Team
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant