Comments (5)
@mjs7231 Honestly we didn't test it on large tables. We'll do it.
from dbglass.
You can try:
SELECT reltuples AS approximate_row_count FROM pg_class WHERE relname = 'tbl';
from https://wiki.postgresql.org/wiki/Count_estimate
This is much faster than SELECT COUNT(*) on large tables and on tables that have a lot of dead rows.
from dbglass.
https://github.com/web-pal/DBGlass/blob/master/app/actions/tables.js#L62
Here we getting list of tables, using 3 queries. We have to try to get all needed information using one query.
SELECT rel.relname, rel.relkind, rel.reltuples, coalesce(rel.relpages,0)
+ coalesce(toast.relpages,0) AS num_total_pages, SUM(ind.relpages) AS index_pages,
pg_roles.rolname AS owner FROM pg_class rel left join pg_class toast
on (toast.oid = rel.reltoastrelid) left join pg_index on (indrelid=rel.oid)
left join pg_class ind on (ind.oid = indexrelid) join pg_namespace
on (rel.relnamespace =pg_namespace.oid ) left join pg_roles
on ( rel.relowner = pg_roles.oid ) WHERE rel.relkind IN ('r','v','m','f')
AND nspname = 'public'GROUP BY rel.relname, rel.relkind, rel.reltuples,
coalesce(rel.relpages,0) + coalesce(toast.relpages,0), pg_roles.rolname
Some kind of this.
Using this query we also get very quickly approx count of rows on each table and if we have extremely large table then do not use COUT query.
from dbglass.
@mjs7231 Can you give us more details, how many rows you had on stucked table? Can you provide us schema of this table? I tested dbglass on 10millions rows and it worked pretty fast.
Want to fix issue with large tables.
from dbglass.
from dbglass.
Related Issues (20)
- The server does not support SSL connections HOT 3
- Update with character "[" HOT 1
- cmd+s to confirm save HOT 2
- Drop/truncate table not working HOT 2
- Change database on same connection HOT 1
- Problem with concurrently --kill-others "npm run hot-server" "npm run start-hot" HOT 2
- Dark Theme HOT 4
- not able to create more than one connection HOT 1
- escaping String based IDs HOT 4
- ssh tunnel connects to port 5433 by default HOT 1
- Deb package HOT 1
- Unable to DROP table HOT 1
- SO MANY ISSUES WITH THIS APP!! HOT 1
- Date field data represented by {} (Postgres) HOT 1
- New version of DBGlass
- CockroachDB?
- PKGBuild for arch?
- [Question] Any plans to implement a custom query execution?
- [Question] Any plans to implement a filter in the side table listing?
- Loading indefinitely when using 'is not null' or 'is null' in the filters
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dbglass.