Skip to content

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

Merged
simonw merged 1 commit into
simonw:masterfrom
kevindkeogh:faster-table-count
Feb 25, 2020
Merged

Use inspect-file, if possible, for total row count#666
simonw merged 1 commit into
simonw:masterfrom
kevindkeogh:faster-table-count

Conversation

@kevindkeogh

Copy link
Copy Markdown
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

simonw commented Feb 22, 2020

Copy link
Copy Markdown
Owner

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
Copy Markdown
Contributor Author

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

@simonw

simonw commented Feb 25, 2020

Copy link
Copy Markdown
Owner

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