Services
24×7×365 Technical Support
Migration to PostgreSQL
High Availability Deployment
Database Audit
Remote DBA for PostgreSQL
Products
Postgres Pro Enterprise
Postgres Pro Standard
Cloud Solutions
Postgres Extensions
Resources
Blog
Documentation
Webinars
Videos
Presentations
Community
Events
Training Courses
Books
Demo Database
Mailing List Archives
About
Leadership team
Partners
Customers
In the News
Press Releases
Press Info
Services
24×7×365 Technical Support
Migration to PostgreSQL
High Availability Deployment
Database Audit
Remote DBA for PostgreSQL
Products
Postgres Pro Enterprise
Postgres Pro Standard
Cloud Solutions
Postgres Extensions
Resources
Blog
Documentation
Webinars
Videos
Presentations
Community
Events
Training Courses
Books
Demo Database
Mailing List Archives
About
Leadership team
Partners
Customers
In the News
Press Releases
Press Info
Facebook
Downloads
Home
>
mailing lists
select count(*) is slow - Mailing list pgsql-performance
From
aditya desai
Subject
select count(*) is slow
Date
April 6, 2021
13:14:02
Msg-id
CAN0SRDFFCKvS0gv_bnn2Pg=G7eu7GAu+b0yeariVpuhQ_ewQXg@mail.gmail.com
Whole thread
Raw
Responses
Re: select count(*) is slow
List
pgsql-performance
Tree view
Hi,
Below query takes 12 seconds. We have an index on postcode.
select count(*) from table where postcode >= '00420' AND postcode <= '00500'
index:
CREATE INDEX Table_i1
ON table USING btree
((postcode::numeric));
Table has 180,000 rows and the count is 150,000. Expectation is to run this query in 2-3 seconds(it takes 2 seconds in Oracle).
Here is a query plan:
"Aggregate (cost=622347.34..622347.35 rows=1 width=8) (actual time=12850.580..12850.580 rows=1 loops=1)"
" -> Bitmap Heap Scan on table (cost=413379.89..621681.38 rows=266383 width=0) (actual time=12645.656..12835.185 rows=209749 loops=1)"
" Recheck Cond: (((postcode)::text >= '00420'::text) AND ((postcode)::text <= '00500'::text))"
" Heap Blocks: exact=118286"
" -> Bitmap Index Scan on table_i4 (cost=0.00..413313.29 rows=266383 width=0) (actual time=12615.321..12615.321 rows=209982 loops=1)"
" Index Cond: (((postcode)::text >= '00420'::text) AND ((postcode)::text <= '00500'::text))"
"Planning Time: 0.191 ms"
"Execution Time: 12852.823 ms"
Regards,
Aditya.
pgsql-performance
by date:
Previous
From:
hubert depesz lubaczewski
Date:
06 April 2021, 10:41:48
Subject:
Re: Substitute for synonym in Oracle after migration to postgres
Next
From:
aditya desai
Date:
06 April 2021, 13:19:16
Subject:
Re: Substitute for synonym in Oracle after migration to postgres
Есть вопросы? Напишите нам!
Соглашаюсь с условиями обработки персональных данных
I confirm that I have read and accepted PostgresPro’s
Privacy Policy
.
I agree to get Postgres Pro discount offers and other marketing communications.
✖
×
×
Everywhere
Documentation
Mailing list
List:
all lists
pgsql-general
pgsql-hackers
buildfarm-members
pgadmin-hackers
pgadmin-support
pgsql-admin
pgsql-advocacy
pgsql-announce
pgsql-benchmarks
pgsql-bugs
pgsql-chat
pgsql-cluster-hackers
pgsql-committers
pgsql-cygwin
pgsql-docs
pgsql-hackers-pitr
pgsql-hackers-win32
pgsql-interfaces
pgsql-jdbc
pgsql-jobs
pgsql-novice
pgsql-odbc
pgsql-patches
pgsql-performance
pgsql-php
pgsql-pkg-debian
pgsql-pkg-yum
pgsql-ports
pgsql-rrreviewers
pgsql-ru-general
pgsql-sql
pgsql-students
pgsql-testers
pgsql-translators
pgsql-www
psycopg
Period
anytime
within last day
within last week
within last month
within last 6 months
within last year
Sort by
date
reverse date
rank
Services
24×7×365 Technical Support
Migration to PostgreSQL
High Availability Deployment
Database Audit
Remote DBA for PostgreSQL
Products
Postgres Pro Enterprise
Postgres Pro Standard
Cloud Solutions
Postgres Extensions
Resources
Blog
Documentation
Webinars
Videos
Presentations
Community
Events
Training Courses
Books
Demo Database
Mailing List Archives
About
Leadership team
Partners
Customers
In the News
Press Releases
Press Info
By continuing to browse this website, you agree to the use of cookies. Go to
Privacy Policy
.
I accept cookies