Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hf91L-0002eW-2E for pgsql-hackers@arkaria.postgresql.org; Sun, 23 Jun 2019 20:23:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hf91J-0004EN-RA for pgsql-hackers@arkaria.postgresql.org; Sun, 23 Jun 2019 20:23:25 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hf91J-0004DB-Ef for pgsql-hackers@lists.postgresql.org; Sun, 23 Jun 2019 20:23:25 +0000 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hf91G-0004V3-G2 for pgsql-hackers@lists.postgresql.org; Sun, 23 Jun 2019 20:23:24 +0000 Received: by mail-wr1-x433.google.com with SMTP id p13so11612546wru.10 for ; Sun, 23 Jun 2019 13:23:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=l8al0FzjJLX4CkUyOMiVdFLMpyNM70gxDEfjqJcmv28=; b=hQPyK7elFSaAicknz0GTbnF8ZPjwkDePFjqGZ0QlNAcylOISS5SSkk0f6tKslibdbr /5a3tCJOEDd2HxvlPlPjEHucdtX5p++HjCvocuS5SgcyXs9akNj0SVlPOdnv18LZLu7E o7x2CifZjZWZBKT75kut7K1KuZPvYaN8wnDwuhITM9GwlrLnVXYEg3WV8KKRI9mb/DLq b3ZQvdoiLh2zskklUu4GOtekbL/4sMAOKmqGko/PDtjQpGM/3HdtDG5KfWvq9QmJEbC9 4ISvjhLPBm+iazDM0rNFGsSv2yn+wFRcnSkw2Dh5Jo/+faE/DP4fsjJ/7IjTooINjLj3 pLug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=l8al0FzjJLX4CkUyOMiVdFLMpyNM70gxDEfjqJcmv28=; b=kw6boxGL6mOdp3lswokkSRq2m+/G+YAND0MlMZZI1hBYavkrFEjWTmGA0VrsZy5M1m tWiAISR6f0Mlo1W+IEHZ0m5LtdHfeyORniMmA7EMba5WI0SRMfgKQMi2GnrBQOH6xN0S pE6zwaFrM6dbUBg7nS0BkeFpJCk8PvGb0MCicZFr0wG5EogNyeYiBknCeyAAq3PtiYRk VYAordn/omNDY55NP05JV9x+/SFHX2rKh3qUzNDCYodUenM1yx62/KZ2BhOQ3Lh351MT byeqMH5SEEGtziPgcnaEfxRJ9RBP4f5k/WRmtU4L3geDOjMDFythw9wopsfFwXU43JTz 64gQ== X-Gm-Message-State: APjAAAVgEvgCdCF20taERHhXmMrMWPYJVesjVYVG3/xuh3NlExPyddAN Z0o5WLbhzbdG75t78MpwMXIk7w== X-Google-Smtp-Source: APXvYqyNfw22wWMHR9SK9I9bF4FESZQAkID5iVl4wJKgc9N0Xu4RkHXEW/SYx+BsFDKcPX5wrEgrFQ== X-Received: by 2002:adf:f948:: with SMTP id q8mr7695818wrr.196.1561321400970; Sun, 23 Jun 2019 13:23:20 -0700 (PDT) Received: from localhost (ip-86-49-253-160.net.upcbroadband.cz. [86.49.253.160]) by smtp.gmail.com with ESMTPSA id 15sm3037215wmk.34.2019.06.23.13.23.20 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 23 Jun 2019 13:23:20 -0700 (PDT) Date: Sun, 23 Jun 2019 22:23:19 +0200 From: Tomas Vondra To: Dean Rasheed Cc: PostgreSQL Hackers Subject: Re: Choosing values for multivariate MCV lists Message-ID: <20190623202319.4lcqsi5zc53hktda@development> References: <20190618205920.qtlzcu73whfpfqne@development> <20190620223548.p22wj7uejbrhkglf@development> <20190622141052.5csokbp3sx577mub@development> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716-1444-295967 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Sun, Jun 23, 2019 at 08:48:26PM +0100, Dean Rasheed wrote: >On Sat, 22 Jun 2019 at 15:10, Tomas Vondra wrote: >> One annoying thing I noticed is that the base_frequency tends to end up >> being 0, most likely due to getting too small. It's a bit strange, though, >> because with statistic target set to 10k the smallest frequency for a >> single column is 1/3e6, so for 2 columns it'd be ~1/9e12 (which I think is >> something the float8 can represent). >> > >Yeah, it should be impossible for the base frequency to underflow to >0. However, it looks like the problem is with mcv_list_items()'s use >of %f to convert to text, which is pretty ugly. > Yeah, I realized that too, eventually. One way to fix that would be adding %.15f to the sprintf() call, but that just adds ugliness. It's probably time to rewrite the function to build the tuple from datums, instead of relying on BuildTupleFromCStrings. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services