Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1egIKF-0004Zu-6J for pgsql-bugs@arkaria.postgresql.org; Mon, 29 Jan 2018 22:54:55 +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 1egIKE-0004OW-3u for pgsql-bugs@arkaria.postgresql.org; Mon, 29 Jan 2018 22:54:54 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1egIKD-0004OJ-Qm for pgsql-bugs@lists.postgresql.org; Mon, 29 Jan 2018 22:54:53 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1egIKB-0003jk-Co for pgsql-bugs@postgresql.org; Mon, 29 Jan 2018 22:54:52 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w0TMsghv014239; Mon, 29 Jan 2018 17:54:42 -0500 From: Tom Lane To: Greg Stark cc: Andres Freund , Tomas Vondra , "Todd A. Cook" , Thomas Munro , PostgreSQL Bugs Subject: Re: BUG #14932: SELECT DISTINCT val FROM table gets stuck in an infinite loop In-reply-to: References: <219b37b2-d740-d04a-203a-49ae422028f7@blackducksoftware.com> <1773c302-2fb1-749f-8ccc-62b23617c5ac@blackducksoftware.com> <25629.1512580464@sss.pgh.pa.us> <20171206171923.dg7phzfh7nb4lou3@alap3.anarazel.de> <7de4b2d6-b119-7d15-04d8-4c0fcb29cbc3@2ndquadrant.com> <20180126234537.dyu6jwnqz7snpq7n@alap3.anarazel.de> <14184.1517010515@sss.pgh.pa.us> <20180129010213.rt3nu73ilff756f6@alap3.anarazel.de> <5429.1517250335@sss.pgh.pa.us> <20180129183049.xqoejgs52x37xnyr@alap3.anarazel.de> <6340.1517251510@sss.pgh.pa.us> <7425.1517253086@sss.pgh.pa.us> Comments: In-reply-to Greg Stark message dated "Mon, 29 Jan 2018 22:16:24 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <14237.1517266482.1@sss.pgh.pa.us> Date: Mon, 29 Jan 2018 17:54:42 -0500 Message-ID: <14238.1517266482@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Greg Stark writes: > On 29 January 2018 at 19:11, Tom Lane wrote: >> One other point here is that it's not really clear to me what a randomly >> varying IV is supposed to accomplish. Surely we're not intending that >> it prevents somebody from crafting a data set that causes bad hash >> performance. > I actually think that is a real live issue that we will be forced to > deal with one day. And I think that day is coming soon. > It's not hard to imagine a user of a web site intentionally naming > their objects such that they all hash to the same value. Probably most > systems the worst case is a query that takes a few seconds or even > tens of seconds but if you get lucky you could run a server out of > memory. By their very nature, hash algorithms have weak spots. Pretending that they do not, or that you can 100% remove them, is a fool's errand. You could always "set enable_hashjoin = off", and deal with mergejoin's weak spots instead; but that just requires a different data set to expose its performance shortcomings ... regards, tom lane