Re: BUG #14932: SELECT DISTINCT val FROM table gets stuck in an infinite loop

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Greg Stark <stark(at)mit(dot)edu>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, "Todd A(dot) Cook" <tcook(at)blackducksoftware(dot)com>, Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, PostgreSQL Bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14932: SELECT DISTINCT val FROM table gets stuck in an infinite loop
Date: 2018-01-29 23:12:58
Message-ID: 20180129231258.atscgnc5qkt3lra5@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 2018-01-29 17:54:42 -0500, Tom Lane wrote:
> Greg Stark <stark(at)mit(dot)edu> writes:
> > On 29 January 2018 at 19:11, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> 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.

Having edge case weaknesses and having remotely triggerable weaknesses
aren't the same. And the cost for preventing such misuse is a
immeasurable runtime difference and returning queries that don't specify
an order and don't have a "natural" order with a changing order. That's
not particularly high.

Greetings,

Andres Freund

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Thomas Munro 2018-01-30 02:06:47 Re: BUG #15036: Un-killable queries Hanging in BgWorkerShutdown
Previous Message Tom Lane 2018-01-29 22:54:42 Re: BUG #14932: SELECT DISTINCT val FROM table gets stuck in an infinite loop