Re: Parallel Seq Scan

From: Thom Brown <thom(at)linux(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>, Robert Haas <robertmhaas(at)gmail(dot)com>, Andres Freund <andres(at)2ndquadrant(dot)com>, Kouhei Kaigai <kaigai(at)ak(dot)jp(dot)nec(dot)com>, Amit Langote <amitlangote09(at)gmail(dot)com>, Fabrízio Mello <fabriziomello(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Parallel Seq Scan
Date: 2015-03-25 13:39:55
Message-ID: CAA-aLv7oJjhvYxH2FLeFkZ+1ScdYvOgfN0Pb1uwSjLiZNxduRg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 25 March 2015 at 11:46, Thom Brown <thom(at)linux(dot)com> wrote:
>
>
> Still not sure why 8 workers are needed for each partial scan. I would
> expect 8 workers to be used for 8 separate scans. Perhaps this is just my
> misunderstanding of how this feature works.
>

Another issue:

SELECT * FROM pgb<tab>

*crash*

Logs:

2015-03-25 13:17:49 GMT [22823]: [124-1] user=,db=,client= LOG:
registering background worker "parallel worker for PID 24792"
2015-03-25 13:17:49 GMT [22823]: [125-1] user=,db=,client= LOG:
registering background worker "parallel worker for PID 24792"
2015-03-25 13:17:49 GMT [22823]: [126-1] user=,db=,client= LOG:
registering background worker "parallel worker for PID 24792"
2015-03-25 13:17:49 GMT [22823]: [127-1] user=,db=,client= LOG:
registering background worker "parallel worker for PID 24792"
2015-03-25 13:17:49 GMT [22823]: [128-1] user=,db=,client= LOG:
registering background worker "parallel worker for PID 24792"
2015-03-25 13:17:49 GMT [22823]: [129-1] user=,db=,client= LOG:
registering background worker "parallel worker for PID 24792"
2015-03-25 13:17:49 GMT [22823]: [130-1] user=,db=,client= LOG:
registering background worker "parallel worker for PID 24792"
2015-03-25 13:17:49 GMT [22823]: [131-1] user=,db=,client= LOG:
registering background worker "parallel worker for PID 24792"
2015-03-25 13:17:49 GMT [22823]: [132-1] user=,db=,client= LOG: starting
background worker process "parallel worker for PID 24792"
2015-03-25 13:17:49 GMT [22823]: [133-1] user=,db=,client= LOG: starting
background worker process "parallel worker for PID 24792"
2015-03-25 13:17:49 GMT [22823]: [134-1] user=,db=,client= LOG: starting
background worker process "parallel worker for PID 24792"
2015-03-25 13:17:49 GMT [22823]: [135-1] user=,db=,client= LOG: starting
background worker process "parallel worker for PID 24792"
2015-03-25 13:17:49 GMT [22823]: [136-1] user=,db=,client= LOG: starting
background worker process "parallel worker for PID 24792"
2015-03-25 13:17:49 GMT [22823]: [137-1] user=,db=,client= LOG: starting
background worker process "parallel worker for PID 24792"
2015-03-25 13:17:49 GMT [22823]: [138-1] user=,db=,client= LOG: starting
background worker process "parallel worker for PID 24792"
2015-03-25 13:17:49 GMT [22823]: [139-1] user=,db=,client= LOG: starting
background worker process "parallel worker for PID 24792"
2015-03-25 13:17:49 GMT [22823]: [140-1] user=,db=,client= LOG: worker
process: parallel worker for PID 24792 (PID 24804) was terminated by signal
11: Segmentation fault
2015-03-25 13:17:49 GMT [22823]: [141-1] user=,db=,client= LOG:
terminating any other active server processes
2015-03-25 13:17:49 GMT [24777]: [2-1] user=,db=,client= WARNING:
terminating connection because of crash of another server process
2015-03-25 13:17:49 GMT [24777]: [3-1] user=,db=,client= DETAIL: The
postmaster has commanded this server process to roll back the current
transaction and exit, because another server process exited abnormally and
possibly corrupted shared memory.
2015-03-25 13:17:49 GMT [24777]: [4-1] user=,db=,client= HINT: In a moment
you should be able to reconnect to the database and repeat your command.

Backtrace:

#0 GrantLockLocal (locallock=locallock(at)entry=0xfbe7f0,
owner=owner(at)entry=0x1046da0)
at lock.c:1544
#1 0x000000000066975c in LockAcquireExtended
(locktag=locktag(at)entry=0x7fffdcb0ea20,
lockmode=1,
lockmode(at)entry=<error reading variable: Cannot access memory at address
0x7fffdcb0e9f0>, sessionLock=sessionLock(at)entry=0 '\000',
dontWait=dontWait(at)entry=0 '\000',
reportMemoryError=reportMemoryError(at)entry=1 '\001', ) at lock.c:798
#2 0x000000000066a1c4 in LockAcquire (locktag=locktag(at)entry=0x7fffdcb0ea20,
lockmode=<error reading variable: Cannot access memory at address
0x7fffdcb0e9f0>,
sessionLock=sessionLock(at)entry=0 '\000', dontWait=dontWait(at)entry=0
'\000') at lock.c:680
#3 0x0000000000667c48 in LockRelationOid (relid=<error reading variable:
Cannot access memory at address 0x7fffdcb0e9e8>,
relid(at)entry=<error reading variable: Cannot access memory at address
0x7fffdcb0ea48>,
lockmode=<error reading variable: Cannot access memory at address
0x7fffdcb0e9f0>,
lockmode(at)entry=<error reading variable: Cannot access memory at address
0x7fffdcb0ea48>) at lmgr.c:94

But the issue seems to produce a different backtrace each time...

2nd backtrace:

#0 hash_search_with_hash_value (hashp=0x2a2c370,
keyPtr=keyPtr(at)entry=0x7ffff5ad2230,
hashvalue=hashvalue(at)entry=2114233864, action=action(at)entry=HASH_FIND,
foundPtr=foundPtr(at)entry=0x0) at dynahash.c:918
#1 0x0000000000654d1a in BufTableLookup (tagPtr=tagPtr(at)entry=0x7ffff5ad2230,
hashcode=hashcode(at)entry=2114233864) at buf_table.c:96
#2 0x000000000065746b in BufferAlloc (foundPtr=0x7ffff5ad222f <Address
0x7ffff5ad222f out of bounds>, strategy=0x0,
blockNum=<error reading variable: Cannot access memory at address
0x7ffff5ad2204>,
forkNum=<error reading variable: Cannot access memory at address
0x7ffff5ad2208>,
relpersistence=<error reading variable: Cannot access memory at address
0x7ffff5ad2214>, smgr=0x2aaae00) at bufmgr.c:893
#3 ReadBuffer_common (smgr=0x2aaae00, relpersistence=<optimized out>, ) at
bufmgr.c:641
#4 0x0000000000657e40 in ReadBufferExtended (reln=<error reading variable:
Cannot access memory at address 0x7ffff5ad2278>,
reln(at)entry=<error reading variable: Cannot access memory at address
0x7ffff5ad22f8>, forkNum=MAIN_FORKNUM, blockNum=6, mode=<optimized out>,
strategy=<optimized out>) at bufmgr.c:560

3rd backtrace:

#0 hash_search_with_hash_value (hashp=0x1d97370,
keyPtr=keyPtr(at)entry=0x7ffff95855f0,
hashvalue=hashvalue(at)entry=2382868486, action=action(at)entry=HASH_FIND,
foundPtr=foundPtr(at)entry=0x0) at dynahash.c:907
#1 0x0000000000654d1a in BufTableLookup (tagPtr=tagPtr(at)entry=0x7ffff95855f0,
hashcode=hashcode(at)entry=2382868486) at buf_table.c:96
#2 0x000000000065746b in BufferAlloc (foundPtr=0x7ffff95855ef "",
strategy=0x0, blockNum=9, forkNum=MAIN_FORKNUM, relpersistence=112 'p',
smgr=0x1e15860)
at bufmgr.c:893
#3 ReadBuffer_common (smgr=0x1e15860, relpersistence=<optimized out>,
forkNum=forkNum(at)entry=MAIN_FORKNUM, blockNum=blockNum(at)entry=9,
mode=RBM_NORMAL, strategy=0x0,
hit=hit(at)entry=0x7ffff958569f "") at bufmgr.c:641
#4 0x0000000000657e40 in ReadBufferExtended (reln=reln(at)entry=0x7f8a17bab2c0,
forkNum=forkNum(at)entry=MAIN_FORKNUM, blockNum=9, mode=mode(at)entry=RBM_NORMAL,
strategy=strategy(at)entry=0x0) at bufmgr.c:560
#5 0x0000000000657f4d in ReadBuffer (blockNum=<optimized out>,
reln=0x7f8a17bab2c0) at bufmgr.c:492
#6 ReleaseAndReadBuffer (buffer=buffer(at)entry=398111424,
relation=relation(at)entry=0x1, blockNum=<optimized out>) at bufmgr.c:1403
#7 0x000000000049e6bf in _bt_relandgetbuf (rel=0x1, rel(at)entry=0x7f8a17bab2c0,
obuf=398111424, blkno=blkno(at)entry=9, access=access(at)entry=1) at nbtpage.c:707
#8 0x00000000004a24b4 in _bt_search (rel=rel(at)entry=0x7f8a17bab2c0,
keysz=keysz(at)entry=2, scankey=scankey(at)entry=0x7ffff95858b0,
nextkey=nextkey(at)entry=0 '\000',
bufP=bufP(at)entry=0x7ffff95857ac, access=access(at)entry=1) at
nbtsearch.c:131
#9 0x00000000004a2cb4 in _bt_first (scan=scan(at)entry=0x1eb2048,
dir=dir(at)entry=ForwardScanDirection) at nbtsearch.c:940
#10 0x00000000004a1141 in btgettuple (fcinfo=<optimized out>) at
nbtree.c:288
#11 0x0000000000759132 in FunctionCall2Coll (flinfo=flinfo(at)entry=0x1e34390,
collation=collation(at)entry=0, arg1=arg1(at)entry=32186440, arg2=arg2(at)entry=1)
at fmgr.c:1323
#12 0x000000000049b273 in index_getnext_tid (scan=scan(at)entry=0x1eb2048,
direction=direction(at)entry=ForwardScanDirection) at indexam.c:462
#13 0x000000000049b450 in index_getnext (scan=0x1eb2048,
direction=direction(at)entry=ForwardScanDirection) at indexam.c:602
#14 0x000000000049a9a9 in systable_getnext (sysscan=sysscan(at)entry=0x1eb1ff8)
at genam.c:416
#15 0x0000000000740452 in SearchCatCache (cache=0x1ddf540, v1=<optimized
out>, v2=<optimized out>, v3=<optimized out>, v4=<optimized out>) at
catcache.c:1248
#16 0x000000000074bd06 in GetSysCacheOid (cacheId=cacheId(at)entry=44,
key1=key1(at)entry=140226851237264, key2=<optimized out>, key3=key3(at)entry=0,
key4=key4(at)entry=0)
at syscache.c:988
#17 0x000000000074d674 in get_relname_relid
(relname=relname(at)entry=0x7f891ba7ed90
"pgbench_accounts_3", relnamespace=<optimized out>) at lsyscache.c:1602
#18 0x00000000004e1228 in RelationIsVisible (relid=relid(at)entry=16428) at
namespace.c:740
#19 0x00000000004e4b6f in pg_table_is_visible (fcinfo=0x1e9dfc8) at
namespace.c:4078
#20 0x0000000000595f72 in ExecMakeFunctionResultNoSets (fcache=0x1e9df58,
econtext=0x1e99848, isNull=0x7ffff95871bf "", isDone=<optimized out>) at
execQual.c:2015
#21 0x000000000059b469 in ExecQual (qual=qual(at)entry=0x1e9b368,
econtext=econtext(at)entry=0x1e99848, resultForNull=resultForNull(at)entry=0
'\000') at execQual.c:5206
#22 0x000000000059b9a6 in ExecScan (node=node(at)entry=0x1e99738,
accessMtd=accessMtd(at)entry=0x5ad780 <PartialSeqNext>,
recheckMtd=recheckMtd(at)entry=0x5ad770 <PartialSeqRecheck>) at
execScan.c:195
#23 0x00000000005ad8d0 in ExecPartialSeqScan (node=node(at)entry=0x1e99738) at
nodePartialSeqscan.c:241
#24 0x0000000000594f68 in ExecProcNode (node=0x1e99738) at
execProcnode.c:422
#25 0x00000000005a39b6 in funnel_getnext (funnelstate=0x1e943c8) at
nodeFunnel.c:308
#26 ExecFunnel (node=node(at)entry=0x1e943c8) at nodeFunnel.c:185
#27 0x0000000000594f58 in ExecProcNode (node=0x1e943c8) at
execProcnode.c:426
#28 0x00000000005a0212 in ExecAppend (node=node(at)entry=0x1e941d8) at
nodeAppend.c:209
#29 0x0000000000594fa8 in ExecProcNode (node=node(at)entry=0x1e941d8) at
execProcnode.c:399
#30 0x00000000005a0c9e in agg_fill_hash_table (aggstate=0x1e93ba8) at
nodeAgg.c:1353
#31 ExecAgg (node=node(at)entry=0x1e93ba8) at nodeAgg.c:1115
#32 0x0000000000594e38 in ExecProcNode (node=node(at)entry=0x1e93ba8) at
execProcnode.c:506
#33 0x00000000005a8144 in ExecLimit (node=node(at)entry=0x1e93908) at
nodeLimit.c:91
#34 0x0000000000594d98 in ExecProcNode (node=node(at)entry=0x1e93908) at
execProcnode.c:530
#35 0x0000000000592380 in ExecutePlan (dest=0x7f891bbc9f10,
direction=<optimized out>, numberTuples=0, sendTuples=1 '\001',
operation=CMD_SELECT, planstate=0x1e93908,
#36 standard_ExecutorRun (queryDesc=0x1dbb800, direction=<optimized out>,
count=0) at execMain.c:342
#37 0x000000000067e9a8 in PortalRunSelect (portal=0x1e639e0,
portal(at)entry=<error
reading variable: Cannot access memory at address 0x7ffff95874c8>,
forward=<optimized out>, count=0, dest=<optimized out>) at pquery.c:947

4th backtrace:

#0 ScanKeywordLookup (text=text(at)entry=0x1d57fa0
"information_schema_catalog_name", keywords=0x84f220 <ScanKeywords>,
num_keywords=408) at kwlookup.c:64
#1 0x000000000070aa14 in quote_identifier (ident=0x1d57fa0
"information_schema_catalog_name") at ruleutils.c:9009
#2 0x00000000006f54bd in quote_ident (fcinfo=<optimized out>) at quote.c:31
#3 0x0000000000595f72 in ExecMakeFunctionResultNoSets (fcache=0x1d42cb8,
econtext=0x1d3f848, isNull=0x1d42858 "", isDone=<optimized out>) at
execQual.c:2015
#4 0x0000000000595f1d in ExecMakeFunctionResultNoSets (fcache=0x1d424a8,
econtext=0x1d3f848, isNull=0x1d42048 "", isDone=<optimized out>) at
execQual.c:1989
#5 0x0000000000595f1d in ExecMakeFunctionResultNoSets (fcache=0x1d41c98,
econtext=0x1d3f848, isNull=0x7fff0bdc61df "", isDone=<optimized out>) at
execQual.c:1989
#6 0x000000000059b469 in ExecQual (qual=qual(at)entry=0x1d41368,
econtext=econtext(at)entry=0x1d3f848, resultForNull=resultForNull(at)entry=0
'\000') at execQual.c:5206
#7 0x000000000059b9a6 in ExecScan (node=node(at)entry=0x1d3f738,
accessMtd=accessMtd(at)entry=0x5ad780 <PartialSeqNext>,
recheckMtd=recheckMtd(at)entry=0x5ad770 <PartialSeqRecheck>) at
execScan.c:195
#8 0x00000000005ad8d0 in ExecPartialSeqScan (node=node(at)entry=0x1d3f738) at
nodePartialSeqscan.c:241
#9 0x0000000000594f68 in ExecProcNode (node=0x1d3f738) at
execProcnode.c:422
#10 0x00000000005a39b6 in funnel_getnext (funnelstate=0x1d3a3c8) at
nodeFunnel.c:308
#11 ExecFunnel (node=node(at)entry=0x1d3a3c8) at nodeFunnel.c:185
#12 0x0000000000594f58 in ExecProcNode (node=0x1d3a3c8) at
execProcnode.c:426
#13 0x00000000005a0212 in ExecAppend (node=node(at)entry=0x1d3a1d8) at
nodeAppend.c:209
#14 0x0000000000594fa8 in ExecProcNode (node=node(at)entry=0x1d3a1d8) at
execProcnode.c:399
#15 0x00000000005a0c9e in agg_fill_hash_table (aggstate=0x1d39ba8) at
nodeAgg.c:1353
#16 ExecAgg (node=node(at)entry=0x1d39ba8) at nodeAgg.c:1115
#17 0x0000000000594e38 in ExecProcNode (node=node(at)entry=0x1d39ba8) at
execProcnode.c:506
#18 0x00000000005a8144 in ExecLimit (node=node(at)entry=0x1d39908) at
nodeLimit.c:91
#19 0x0000000000594d98 in ExecProcNode (node=node(at)entry=0x1d39908) at
execProcnode.c:530
#20 0x0000000000592380 in ExecutePlan (dest=0x7fe8c8a1cf10,
direction=<optimized out>, numberTuples=0, sendTuples=1 '\001',
operation=CMD_SELECT, planstate=0x1d39908,
estate=0x1d01990) at execMain.c:1533
#21 standard_ExecutorRun (queryDesc=0x1c61800, direction=<optimized out>,
count=0) at execMain.c:342
#22 0x000000000067e9a8 in PortalRunSelect (portal=portal(at)entry=0x1d099e0,
forward=forward(at)entry=1 '\001', count=0, count(at)entry=9223372036854775807,
dest=dest(at)entry=0x7fe8c8a1cf10) at pquery.c:947
#23 0x000000000067fd0f in PortalRun (portal=portal(at)entry=0x1d099e0,
count=count(at)entry=9223372036854775807, isTopLevel=isTopLevel(at)entry=1
'\001',
dest=dest(at)entry=0x7fe8c8a1cf10, altdest=altdest(at)entry=0x7fe8c8a1cf10,
completionTag=completionTag(at)entry=0x7fff0bdc6790 "") at pquery.c:791
#24 0x000000000067dab8 in exec_simple_query (
query_string=0x1caf750 "SELECT pg_catalog.quote_ident(c.relname) FROM
pg_catalog.pg_class c WHERE c.relkind IN ('r', 'S', 'v', 'm', 'f') AND
substring(pg_catalog.quote_ident(c.relname),1,3)='pgb' AND
pg_catalog.pg_table_is_v"...) at postgres.c:1107
#25 PostgresMain (argc=<optimized out>, argv=argv(at)entry=0x1c3db60,
dbname=0x1c3da18 "pgbench", username=<optimized out>) at postgres.c:4120
#26 0x0000000000462c8e in BackendRun (port=0x1c621f0) at postmaster.c:4148
#27 BackendStartup (port=0x1c621f0) at postmaster.c:3833
#28 ServerLoop () at postmaster.c:1601
#29 0x000000000062e803 in PostmasterMain (argc=argc(at)entry=1,
argv=argv(at)entry=0x1c3cca0)
at postmaster.c:1248
#30 0x00000000004636dd in main (argc=1, argv=0x1c3cca0) at main.c:221

5th backtrace:

#0 0x000000000075d757 in hash_search_with_hash_value (hashp=0x1d62310,
keyPtr=keyPtr(at)entry=0x7fffb686f4a0, hashvalue=hashvalue(at)entry=171639189,
action=action(at)entry=HASH_ENTER, foundPtr=foundPtr(at)entry=0x7fffb686f44f
<Address 0x7fffb686f44f out of bounds>) at dynahash.c:1026
#1 0x0000000000654d52 in BufTableInsert (tagPtr=tagPtr(at)entry=0x7fffb686f4a0,
hashcode=hashcode(at)entry=171639189, buf_id=169) at buf_table.c:128
#2 0x0000000000657711 in BufferAlloc (foundPtr=0x7fffb686f49f <Address
0x7fffb686f49f out of bounds>, strategy=0x0, blockNum=11,
forkNum=MAIN_FORKNUM,
relpersistence=<error reading variable: Cannot access memory at address
0x7fffb686f484>,
smgr=<error reading variable: Cannot access memory at address
0x7fffb686f488>) at bufmgr.c:1089
#3 ReadBuffer_common (smgr=<error reading variable: Cannot access memory
at address 0x7fffb686f488>, relpersistence=<optimized out>,
forkNum=MAIN_FORKNUM,
forkNum(at)entry=<error reading variable: Cannot access memory at address
0x7fffb686f4f0>, blockNum=11,
blockNum(at)entry=<error reading variable: Cannot access memory at address
0x7fffb686f4f8>, mode=RBM_NORMAL, strategy=0x0,
hit=hit(at)entry=0x7fffb686f54f <Address 0x7fffb686f54f out of bounds>) at
bufmgr.c:641
#4 0x0000000000657e40 in ReadBufferExtended (reln=<error reading variable:
Cannot access memory at address 0x7fffb686f4e8>,
reln(at)entry=<error reading variable: Cannot access memory at address
0x7fffb686f568>,
forkNum=<error reading variable: Cannot access memory at address
0x7fffb686f4f0>,
blockNum=<error reading variable: Cannot access memory at address
0x7fffb686f4f8>, mode=<optimized out>, strategy=<optimized out>) at
bufmgr.c:560
--
Thom

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2015-03-25 13:45:41 Re: Error with index on unlogged table
Previous Message Peter Geoghegan 2015-03-25 13:31:57 Re: Abbreviated keys for Numeric