Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eMglP-0007Dv-9w for pgsql-bugs@arkaria.postgresql.org; Wed, 06 Dec 2017 20:57: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 1eMglO-0001m7-TP for pgsql-bugs@arkaria.postgresql.org; Wed, 06 Dec 2017 20:57: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 1eMglO-0001lx-Kd for pgsql-bugs@lists.postgresql.org; Wed, 06 Dec 2017 20:57:54 +0000 Received: from tamriel.snowman.net ([96.255.250.162]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1eMglL-0007zr-OX for pgsql-bugs@postgresql.org; Wed, 06 Dec 2017 20:57:53 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id D35625F795; Wed, 6 Dec 2017 15:57:50 -0500 (EST) Date: Wed, 6 Dec 2017 15:57:50 -0500 From: Stephen Frost To: Andres Freund Cc: Tomas Vondra , "Todd A. Cook" , Tom Lane , Thomas Munro , PostgreSQL Bugs Subject: Re: BUG #14932: SELECT DISTINCT val FROM table gets stuck in an infinite loop Message-ID: <20171206205750.GM4628@tamriel.snowman.net> References: <17357.1511841783@sss.pgh.pa.us> <9cd29b81-7ba1-91a2-f491-9014f4ac87e6@blackducksoftware.com> <2a76784c-06cb-46ec-35be-9895d144b839@2ndquadrant.com> <263b03b1-3e1c-49ca-165a-8ac6751419c4@2ndquadrant.com> <20171206193545.3imvbfwjgrmuho3s@alap3.anarazel.de> <790BC80E-D8E5-499B-A1E3-8EE0752B53ED@anarazel.de> <06523583-b9c5-1424-ef0a-1fc8063e9ed7@2ndquadrant.com> <20171206204616.wcect35fuj5gjde2@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="RGLYbkj9zTkxqj+x" Content-Disposition: inline In-Reply-To: <20171206204616.wcect35fuj5gjde2@alap3.anarazel.de> User-Agent: Mutt/1.5.21 (2010-09-15) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --RGLYbkj9zTkxqj+x Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Andres, all, * Andres Freund (andres@anarazel.de) wrote: > On 2017-12-06 21:38:42 +0100, Tomas Vondra wrote: > > FWIW I've constructed the data sets for two reasons - to convince myself > > that my understanding of the simplehash code is correct, and to provide > > a data set triggering the other growth condition in simplehash code. My > > understanding is that if we stop growing the table after the load factor > > drops below some threshold (as TL proposed earlier in this thread), it > > should address both of these cases. >=20 > Yea, I'm not adverse to adding a few stopgaps that break in a less > annoying manner. WAll I'm saying is that I don't think we need to be > super concerned about this specific way of breaking things. I think I'm agreeing with Tomas here when I say that we shouldn't have a system that breaks in the "tries to allocate infinite memory" way when the load factor drops far below some reasonable threshold and that we *should* be concerned that we have this problem in the existing implementation. It's bad, and we should care about that and fix it. Running forever in a loop isn't great either, but at least you only expend at most one CPU to it and can go kill it, assuming we have an appropriate CHECK_FOR_INTERRUPTS() placement. Running the box out of memory can lead to other things *failing* (even entirely reasonable things!), not just being slower. That's an important difference. Thanks! Stephen --RGLYbkj9zTkxqj+x Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJaKFnOAAoJEO1sijiDR2RVrssQAJjJZ6P0bDPseOyOREB/PKy4 5+R6fuwlJ+MWJ39fd0AixE0lWWBLYWCYhXr9eEdJOTeRWdB2s7vypDDQes1/4W+i pQIk6qvzkT+iZOn3TlltCAubyjsiApxE84epT50YoCM97CjhbqONx8qLEWdYCicA JJ8USwKxC0eL9xIY27DrSZIF+jC+CxIhRyAHCRzPPMe6rqcBHnYWiu9C+6isflwy oVOXNInkE3dAJj9PNXUgQb90adtltcERf+d+fAFVegiZ2QCr1h0K7zMhiGaj1byR cJWHm+HYUUgZX51uw4+ToJeOIg03G2y0kVGQ03ODQUDX2L+BHrD0UFMAjQ0oMenc LKMbVDEGquUTCrkKOuVSK89OZxdH3eLJR+RY9WQDRDZ6I6si+pqReakdZZucIaxI JUCg9afuwBTZCtn9oo/FKC8JWXQHbp027T+g2n5nSSQ1tV+B3/gqxeBOENcJqp80 U7rLq/W5dP+S4vf01659RNchgzyGktTebL5bvNc9mfGECAKUl4lKPKTPfXNE3Yje L1IvNT1SNWH+PWujEGsSKHClHYzwy/TTiWlYOs1uBjkDntCr4hDUval8j8Kkx8uS KJLDcxzvoXXd4JQQgNoGdchlzM9YGq8xZuqn8A+6bskcCz7DxMJllPZeBtyoO/7a eRyjcHgwRhL0gYQJVjvu =WeBU -----END PGP SIGNATURE----- --RGLYbkj9zTkxqj+x--