Re: Parallel Seq Scan

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Thom Brown <thom(at)linux(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Parallel Seq Scan
Date: 2015-11-11 17:59:28
Message-ID: CAFj8pRBF-i=qDg9b5nZrXYfChzBEZWmthxYPhidQvwoMOjHtzg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

I have a first query

I looked on EXPLAIN ANALYZE output and the numbers of filtered rows are
differen

postgres=# set max_parallel_degree to 4;
SET
Time: 0.717 ms
postgres=# EXPLAIN ANALYZE select count(*) from xxx where a % 10 = 0;
┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ QUERY
PLAN │
╞═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╡
│ Aggregate (cost=9282.50..9282.51 rows=1 width=0) (actual
time=142.541..142.541 rows=1 loops=1) │
│ -> Gather (cost=1000.00..9270.00 rows=5000 width=0) (actual
time=0.633..130.926 rows=100000 loops=1) │
│ Number of Workers:
2

│ -> Parallel Seq Scan on xxx (cost=0.00..7770.00 rows=5000
width=0) (actual time=0.052..411.303 rows=169631 loops=1) │
│ Filter: ((a % 10) =
0)

│ Rows Removed by Filter:
1526399

│ Planning time: 0.167
ms

│ Execution time: 144.519
ms

└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
(8 rows)

Time: 145.374 ms
postgres=# set max_parallel_degree to 1;
SET
Time: 0.706 ms
postgres=# EXPLAIN ANALYZE select count(*) from xxx where a % 10 = 0;
┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ QUERY
PLAN │
╞════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╡
│ Aggregate (cost=14462.50..14462.51 rows=1 width=0) (actual
time=163.355..163.355 rows=1 loops=1) │
│ -> Gather (cost=1000.00..14450.00 rows=5000 width=0) (actual
time=0.485..152.827 rows=100000 loops=1) │
│ Number of Workers:
1

│ -> Parallel Seq Scan on xxx (cost=0.00..12950.00 rows=5000
width=0) (actual time=0.043..309.740 rows=145364 loops=1) │
│ Filter: ((a % 10) =
0)

│ Rows Removed by Filter:
1308394

│ Planning time: 0.129
ms

│ Execution time: 165.102
ms

└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
(8 rows)

Rows removed by filter: 1308394 X 1526399. Is it expected?

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thom Brown 2015-11-11 18:03:45 Re: Parallel Seq Scan
Previous Message Robert Haas 2015-11-11 17:53:23 Re: Foreign join pushdown vs EvalPlanQual