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
Wrong actual number of rows in the Query Plan - Mailing list pgsql-performance
From
Vahe Evoyan
Subject
Wrong actual number of rows in the Query Plan
Date
February 28, 2013
17:01:52
Msg-id
CAETCRjg_3kp-MniE6ZmEH4ZMSE4xiSD=01vsuXrQae4Yxwq32Q@mail.gmail.com
Whole thread
Raw
Responses
Re: Wrong actual number of rows in the Query Plan
List
pgsql-performance
Tree view
Hello,
The Query Plan for the query below shows a large number in its actual rows count by an unknown reason. As a result Merge Join works on a large enough data to slow down the query.
The table which I query has the following description:
Table "public.qor_value"
Column | Type | Modifiers | Storage | Description
-------------+------------------------+---------------------------------------------------------------------+----------+-------------
value_id | integer | not null default nextval('qor_value_denorm_value_id_seq'::regclass) | plain |
run_id | integer | not null | plain |
dft_id | integer | not null | plain |
stat_id | integer | not null | plain |
key | character varying(128) | | extended |
value | numeric(22,10) | | main |
line_number | integer | not null default nextval('qor_value_line_numbering'::regclass) | plain |
file_number | integer | not null | plain |
Indexes:
"qor_value_cluster" btree (run_id, stat_id) CLUSTER INVALID
"qor_value_filtered_self_join" btree (run_id, stat_id, key, dft_id, line_number) INVALID
"qor_value_self_join" btree (run_id, stat_id, dft_id, key, line_number)
Here is the query:
EXPLAIN ANALYZE
SELECT *
FROM "qor_value" V1
INNER JOIN "qor_value" V2
USING ("dft_id", "stat_id", "key")
WHERE
V1."stat_id" = 342 AND
V1."run_id" = 60807 AND
V2."run_id" = 60875;
QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------------------------------------
Merge Join (cost=0.00..2513.96 rows=1 width=72) (actual time=127.361..473.687 rows=66460 loops=1)
Merge Cond: ((v1.dft_id = v2.dft_id) AND ((v1.key)::text = (v2.key)::text))
-> Index Scan using qor_value_self_join on qor_value v1 (cost=0.00..1255.60 rows=275 width=51) (actual time=89.549..97.045 rows=1388 loops=1)
Index Cond: ((run_id = 60807) AND (stat_id = 342))
-> Index Scan using qor_value_self_join on qor_value v2 (cost=0.00..1255.60 rows=275 width=51) (actual time=37.796..134.286 rows=66343 loops=1)
Index Cond: ((run_id = 60875) AND (stat_id = 342))
Total runtime: 544.646 ms
(7 rows)
Note that the second Index Scan has 66343 rows in place of 1388. Here is the query which proves that:
SELECT COUNT(*) FROM "qor_value" WHERE run_id = 60875 AND stat_id = 342;
count
-------
1388
Please help me to figure out where the problem is.
Thanks in advance,
Vahe
pgsql-performance
by date:
Previous
From:
Scott Marlowe
Date:
28 February 2013, 17:00:00
Subject:
Re: High CPU usage / load average after upgrading to Ubuntu 12.04
Next
From:
Costin Oproiu
Date:
28 February 2013, 17:07:27
Subject:
pgbench intriguing results: better tps figures for larger scale factor
Есть вопросы? Напишите нам!
Соглашаюсь с условиями обработки персональных данных
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