Skip to content

Use inspect-file, if possible, for total row count #666

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

Merged
merged 1 commit into from
Feb 25, 2020
Merged

Use inspect-file, if possible, for total row count #666

merged 1 commit into from
Feb 25, 2020

Conversation

kevindkeogh
Copy link
Contributor

For large tables, counting the number of rows in the table can take a
signficant amount of time. Instead, where an inspect-file is provided
for an immutable database, look up the row-count for a plain count(*).

@simonw
Copy link
Owner

simonw commented Feb 22, 2020

This is a smart optimization. I'd like to add a test for it, since the logic is a tiny bit more complex.

For large tables, counting the number of rows in the table can take a
signficant amount of time. Instead, where an inspect-file is provided
for an immutable database, look up the row-count for a plain count(*).
@kevindkeogh
Copy link
Contributor Author

It was very helpful for me, using it for a 15M row table. Added a test, happy to amend though!

@simonw
Copy link
Owner

simonw commented Feb 25, 2020

This is great, thanks!

@simonw simonw merged commit 3041c6b into simonw:master Feb 25, 2020
@kevindkeogh kevindkeogh deleted the faster-table-count branch March 9, 2020 02:47
simonw pushed a commit that referenced this pull request Mar 26, 2020
For large tables, counting the number of rows in the table can take a
significant amount of time. Instead, where an inspect-file is provided
for an immutable database, look up the row-count for a plain count(*).

Thanks, @kevindkeogh
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

Successfully merging this pull request may close these issues.

2 participants