Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UVNrL-0005Ek-4I for pgsql-bugs@arkaria.postgresql.org; Thu, 25 Apr 2013 15:13:19 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UVNrK-0005TB-4g for pgsql-bugs@arkaria.postgresql.org; Thu, 25 Apr 2013 15:13:18 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UVNr7-0005Ib-Kf for pgsql-bugs@postgresql.org; Thu, 25 Apr 2013 15:13:05 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UVNr1-0001gg-Vd for pgsql-bugs@postgresql.org; Thu, 25 Apr 2013 15:13:05 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id r3PFCrJX024343; Thu, 25 Apr 2013 11:12:53 -0400 (EDT) From: Tom Lane To: haddock@mail.ru cc: pgsql-bugs@postgresql.org Subject: Re: BUG #8117: simple but huge query infinite execution time In-reply-to: References: Comments: In-reply-to haddock@mail.ru message dated "Thu, 25 Apr 2013 14:38:30 -0000" Date: Thu, 25 Apr 2013 11:12:53 -0400 Message-ID: <24342.1366902773@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org haddock@mail.ru writes: > query has the following scheme > SELECT > regexp_matches('...',' (\d+)\:','g'), > regexp_matches('...','\:([\d\.]+)','g') I'm not sure what you're expecting this to do, but what it will actually do is produce a number of rows equal to the least common multiple of the periods of the two set-returning functions. In this example it seems the first call produces 2510 rows and the second 2507 rows. Those numbers have no factors in common, so you get 6292570 rows, the same as if you'd written "select * from regexp_matches(...), regexp_matches(...)". In short, I see no bug here. The behavior of queries with multiple SRFs in the same targetlist is a bit dubious, but we're not going to change it, except perhaps by deprecating such usages altogether. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs