On Wed, Mar 9, 2016 at 9:21 AM, Tomas Vondra <tomas.von...@2ndquadrant.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.von...@2ndquadrant.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@entry=0x7f45dafc7c88, sortdim=sortdim@entry=0, dim=dim@entry=0, vacattrstats=vacattrstats@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@entry=0x170ecf0, attrs=attrs@entry=0x166fdf8, stats=stats@entry=0x16f0dd0, numrows_total=numrows_total@entry=30000) at histogram.c:156 #4 0x00000000007ced19 in build_mv_stats (onerel=onerel@entry=0x7f45e797d040, totalrows=9999985, numrows=numrows@entry=30000, rows=rows@entry=0x170ecf0, natts=natts@entry=2, vacattrstats=vacattrstats@entry=0x166efa0) at common.c:106 #5 0x000000000055ff6b in do_analyze_rel (onerel=onerel@entry=0x7f45e797d040, options=options@entry=2, va_cols=va_cols@entry=0x0, acquirefunc=<optimized out>, relpages=44248, inh=inh@entry=0 '\000', in_outer_xact=in_outer_xact@entry=0 '\000', elevel=elevel@entry=13, params=0x7ffcbe382a30) at analyze.c:585 #6 0x0000000000560ced in analyze_rel (relid=relid@entry=16441, relation=relation@entry=0x16bc9d0, options=options@entry=2, params=params@entry=0x7ffcbe382a30, va_cols=va_cols@entry=0x0, in_outer_xact=<optimized out>, bstrategy=0x16640f0) at analyze.c:262 #7 0x00000000005b70fd in vacuum (options=2, relation=0x16bc9d0, relid=relid@entry=0, params=params@entry=0x7ffcbe382a30, va_cols=0x0, bstrategy=<optimized out>, bstrategy@entry=0x0, isTopLevel=isTopLevel@entry=1 '\001') at vacuum.c:313 #8 0x00000000005b748e in ExecVacuum (vacstmt=vacstmt@entry=0x16bca20, isTopLevel=isTopLevel@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@entry=0x16f7700, isTopLevel=isTopLevel@entry=1 '\001', dest=dest@entry=0x16bcd60, altdest=altdest@entry=0x16bcd60, completionTag=completionTag@entry=0x7ffcbe382fa0 "") at pquery.c:1306 #13 0x00000000006c7dd9 in PortalRun (portal=portal@entry=0x16f7700, count=count@entry=9223372036854775807, isTopLevel=isTopLevel@entry=1 '\001', dest=dest@entry=0x16bcd60, altdest=altdest@entry=0x16bcd60, completionTag=completionTag@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@entry=0x164baf8, dbname=0x164b9a8 "jjanes", username=<optimized out>) at postgres.c:4021 #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@entry=1, argv=argv@entry=0x164aa10) at postmaster.c:1298 #20 0x000000000047d35e in main (argc=1, argv=0x164aa10) at main.c:228 Cheers, Jeff -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers