Re: multivariate statistics v14

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: multivariate statistics v14
Date: 2016-03-13 07:30:07
Views: Raw Message | Whole Thread | Download mbox
Lists: pgsql-hackers

On Wed, Mar 9, 2016 at 9:21 AM, Tomas Vondra
<tomas(dot)vondra(at)2ndquadrant(dot)com> wrote:
> Hi,
> On Wed, 2016-03-09 at 08:45 -0800, Jeff Janes wrote:
>> On Wed, Mar 9, 2016 at 7:02 AM, Tomas Vondra
>> <tomas(dot)vondra(at)2ndquadrant(dot)com> wrote:
>> > Hi,
>> >
>> > thanks for the feedback. Attached is v14 of the patch series, fixing
>> > most of the points you've raised.
>> Hi Tomas,
>> Applied to aa09cd242fa7e3a694a31f, I still get the seg faults in make
>> check if I configure without --enable-cassert.
> Ah, after disabling asserts I can reproduce it too. And the reason why
> it fails is quite simple - clauselist_selectivity modifies the original
> list of clauses, which then confuses cost_qual_eval.
> Can you try if the attached patch fixes the issue? I'll need to rework a
> bit more of the code, but let's see if this fixes the issue on your
> machine too.

That patch on top of v14 did fix the original problem. But I got
another segfault:

jjanes=# create table foo as select x, floor(x/(10000000/500))::int as
y from generate_series(1,10000000) f(x);
jjanes=# create index on foo (x,y);
jjanes=# create index on foo (y,x);
jjanes=# create statistics jjj on foo (x,y) with (dependencies,histogram);
jjanes=# analyze ;
server closed the connection unexpectedly

#0 multi_sort_add_dimension (mss=mss(at)entry=0x7f45dafc7c88,
sortdim=sortdim(at)entry=0, dim=dim(at)entry=0,
vacattrstats=vacattrstats(at)entry=0x16f0dd0) at common.c:436
#1 0x00000000007d022a in update_bucket_ndistinct (attrs=0x166fdf8,
stats=0x16f0dd0, bucket=<optimized out>) at histogram.c:1384
#2 0x00000000007d09aa in create_initial_mv_bucket (stats=0x16f0dd0,
attrs=0x166fdf8, rows=0x17cda20, numrows=30000) at histogram.c:880
#3 build_mv_histogram (numrows=30000, rows=rows(at)entry=0x170ecf0,
attrs=attrs(at)entry=0x166fdf8, stats=stats(at)entry=0x16f0dd0,
at histogram.c:156
#4 0x00000000007ced19 in build_mv_stats
(onerel=onerel(at)entry=0x7f45e797d040, totalrows=9999985,
numrows=numrows(at)entry=30000, rows=rows(at)entry=0x170ecf0,
vacattrstats=vacattrstats(at)entry=0x166efa0) at common.c:106
#5 0x000000000055ff6b in do_analyze_rel
(onerel=onerel(at)entry=0x7f45e797d040, options=options(at)entry=2,
va_cols=va_cols(at)entry=0x0, acquirefunc=<optimized out>,
inh=inh(at)entry=0 '\000', in_outer_xact=in_outer_xact(at)entry=0
'\000', elevel=elevel(at)entry=13, params=0x7ffcbe382a30) at
#6 0x0000000000560ced in analyze_rel (relid=relid(at)entry=16441,
relation=relation(at)entry=0x16bc9d0, options=options(at)entry=2,
va_cols=va_cols(at)entry=0x0, in_outer_xact=<optimized out>,
bstrategy=0x16640f0) at analyze.c:262
#7 0x00000000005b70fd in vacuum (options=2, relation=0x16bc9d0,
relid=relid(at)entry=0, params=params(at)entry=0x7ffcbe382a30, va_cols=0x0,
bstrategy=<optimized out>,
bstrategy(at)entry=0x0, isTopLevel=isTopLevel(at)entry=1 '\001') at vacuum.c:313
#8 0x00000000005b748e in ExecVacuum (vacstmt=vacstmt(at)entry=0x16bca20,
isTopLevel=isTopLevel(at)entry=1 '\001') at vacuum.c:121
#9 0x00000000006c90f3 in standard_ProcessUtility
(parsetree=0x16bca20, queryString=0x16bbfc0 "analyze foo ;",
context=<optimized out>, params=0x0, dest=0x16bcd60,
completionTag=0x7ffcbe382fa0 "") at utility.c:654
#10 0x00007f45e413b1d1 in pgss_ProcessUtility (parsetree=0x16bca20,
queryString=0x16bbfc0 "analyze foo ;",
context=PROCESS_UTILITY_TOPLEVEL, params=0x0, dest=0x16bcd60,
completionTag=0x7ffcbe382fa0 "") at pg_stat_statements.c:986
#11 0x00000000006c6841 in PortalRunUtility (portal=0x16f7700,
utilityStmt=0x16bca20, isTopLevel=<optimized out>, dest=0x16bcd60,
completionTag=0x7ffcbe382fa0 "") at pquery.c:1175
#12 0x00000000006c73c5 in PortalRunMulti
(portal=portal(at)entry=0x16f7700, isTopLevel=isTopLevel(at)entry=1 '\001',
dest=dest(at)entry=0x16bcd60, altdest=altdest(at)entry=0x16bcd60,
completionTag=completionTag(at)entry=0x7ffcbe382fa0 "") at pquery.c:1306
#13 0x00000000006c7dd9 in PortalRun (portal=portal(at)entry=0x16f7700,
count=count(at)entry=9223372036854775807, isTopLevel=isTopLevel(at)entry=1
'\001', dest=dest(at)entry=0x16bcd60,
completionTag=completionTag(at)entry=0x7ffcbe382fa0 "") at pquery.c:813
#14 0x00000000006c5c98 in exec_simple_query (query_string=0x16bbfc0
"analyze foo ;") at postgres.c:1094
#15 PostgresMain (argc=<optimized out>, argv=argv(at)entry=0x164baf8,
dbname=0x164b9a8 "jjanes", username=<optimized out>) at
#16 0x000000000047cb1e in BackendRun (port=0x1669d40) at postmaster.c:4258
#17 BackendStartup (port=0x1669d40) at postmaster.c:3932
#18 ServerLoop () at postmaster.c:1690
#19 0x000000000066ff27 in PostmasterMain (argc=argc(at)entry=1,
argv=argv(at)entry=0x164aa10) at postmaster.c:1298
#20 0x000000000047d35e in main (argc=1, argv=0x164aa10) at main.c:228



In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2016-03-13 12:06:33 Re: Performance improvement for joins where outer side is unique
Previous Message Pavel Stehule 2016-03-13 06:48:46 Re: [patch] Proposal for \crosstabview in psql