Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eIhZm-0004wr-4o for pgsql-hackers@arkaria.postgresql.org; Sat, 25 Nov 2017 21:01:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eIhZk-0003Fm-2t for pgsql-hackers@arkaria.postgresql.org; Sat, 25 Nov 2017 21:01:24 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eIhZj-0003Fb-QQ for pgsql-hackers@lists.postgresql.org; Sat, 25 Nov 2017 21:01:23 +0000 Received: from mail-pf0-x22a.google.com ([2607:f8b0:400e:c00::22a]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eIhZf-0007su-4j for pgsql-hackers@postgresql.org; Sat, 25 Nov 2017 21:01:23 +0000 Received: by mail-pf0-x22a.google.com with SMTP id q4so15698951pfg.13 for ; Sat, 25 Nov 2017 13:01:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=HDECuSdPbh5m9t8y5NFd/X8ycFHaBkV1KbntZMyqdH8=; b=fDWsHvXWvujr58e9aZkgamY+QSI9Scac9VTYDgIeAxWbK9ydRph/VmWqTWaew0WTIi gZYnHjuwyXXn7MwIWYewLOyBZGy+9WAhhy2BvHXddZnYX9JGt9YDn0jjLnKf1sv4IUtq GjUV3rCa7Qqj1hZc8KFE7wds4MGg/bOaxzO/rkrMc8AWi4OVumz5cze/g9UqKJLRyexu g0zXu7X3vEk6rqGdJPOKyYhuNvpMISPvDdmDayC6xn2OXcXNJ01xfVolcJlF/1rsiMmg 4rDJT+7rxajaPdQp5mc6DgA47BD7sBbmXLs9huEg4JR8zn8l0i2mlROQHFcFo4tW71Ah iKOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=HDECuSdPbh5m9t8y5NFd/X8ycFHaBkV1KbntZMyqdH8=; b=iWXuX+/P5evwiB6wgGs14thTMDn4y09ow/LuOoFCx4cmqgOywm8Rku9dnsAVclHEYW pJ+mXvlrEUkPtOCywAOJ0qzY1Gwq+Nz78cUad2DZBcUG6/Sm+RQP8i/RoRl4V6cJAWNB XwuRoLvO+o0NrQD/nBeJ+LnXBiXY9OGpNinvTHYImTma4GowLsInuprHxq/EPxVpEcp1 2tn+RFrVgvIjcjJSgdLJ7mGP4ddJ9MbkpKelBl0uJIob9zT2Ipl/KLN+P6D+/FOrYbc9 Qs3Y9WPmvJ8b5BDHt3Grcju/Xz7z6YtyZDVVflN+OER2CA0pL1wIl5V4OpOQlJ4Sm/18 c+cw== X-Gm-Message-State: AJaThX51tYdh0q9aLKIlv85sWmnsKWymksussybkWXN4r1m16ULGbGi/ tnPqgfIaIxsVwx9lZehUIYQ= X-Google-Smtp-Source: AGs4zMZ0AvaUWCQeasKw2WTNgz5VdzOk9Y1vO6t83qa1LMBLOpPqv02NAJh1tbGMrq7+mw4tNiKf9w== X-Received: by 10.101.97.204 with SMTP id j12mr18169085pgv.75.1511643676295; Sat, 25 Nov 2017 13:01:16 -0800 (PST) Received: from [192.168.1.10] (static-50-53-66-203.bvtn.or.frontiernet.net. [50.53.66.203]) by smtp.gmail.com with ESMTPSA id l13sm44146505pfj.73.2017.11.25.13.01.15 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 25 Nov 2017 13:01:15 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: [HACKERS] PATCH: multivariate histograms and MCV lists From: Mark Dilger In-Reply-To: Date: Sat, 25 Nov 2017 13:01:06 -0800 Cc: Adrien Nayrat , Pg Hackers Content-Transfer-Encoding: quoted-printable Message-Id: References: <31ee8686-6d62-7f10-4129-7580ec74a710@dalibo.com> <340ffd44-2d67-d39d-e54f-5a97a842cd3a@2ndquadrant.com> <67EAB5B3-F9FB-4753-8102-4D77DCFFFCD4@gmail.com> To: Tomas Vondra X-Mailer: Apple Mail (2.3124) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > On Nov 18, 2017, at 12:28 PM, Tomas Vondra = wrote: >=20 > Hi, >=20 > Attached is an updated version of the patch, adopting the psql = describe > changes introduced by 471d55859c11b. Hi Tomas, In src/backend/statistics/dependencies.c, you have introduced a comment: + /* + * build an array of SortItem(s) sorted using the multi-sort = support + * + * XXX This relies on all stats entries pointing to the same = tuple + * descriptor. Not sure if that might not be the case. + */ Would you mind explaining that a bit more for me? I don't understand = exactly what you mean here, but it sounds like the sort of thing that needs to be = clarified/fixed before it can be committed. Am I misunderstanding this? In src/backend/statistics/mcv.c, you have comments: + * FIXME: Single-dimensional MCV is sorted by frequency (descending). = We + * should do that too, because when walking through the list we want to + * check the most frequent items first. + * + * TODO: We're using Datum (8B), even for data types (e.g. int4 or = float4). + * Maybe we could save some space here, but the bytea compression = should + * handle it just fine. + * + * TODO: This probably should not use the ndistinct directly (as = computed from + * the table, but rather estimate the number of distinct values in the + * table), no? Do you intend these to be fixed/implemented prior to committing this = patch? Further down in function statext_mcv_build, you have two loops, the = first allocating memory and the second initializing the memory. There is no clear reason = why this must be done in two loops. I tried combining the two loops into one, = and it worked just fine, but did not look any cleaner to me. Feel free to disregard = this paragraph if you like it better the way you currently have it organized. Further down in statext_mcv_deserialize, you have some elogs which might = need to be ereports. It is unclear to me whether you consider these deserialize = error cases to be "can't happen" type errors. If so, you might add that fact to the = comments rather than changing the elogs to ereports. mark