Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id DC2371FA2A4D for ; Thu, 26 Jul 2012 11:42:53 -0300 (ADT) Received: from mail-lb0-f174.google.com ([209.85.217.174]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SuPHA-00059b-43 for pgsql-performance@postgresql.org; Thu, 26 Jul 2012 14:42:52 +0000 Received: by lbbgm6 with SMTP id gm6so1519161lbb.19 for ; Thu, 26 Jul 2012 07:42:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding:x-gm-message-state; bh=us2Ipzzl1ZGYwwcXIpICWP2wTWw4rEpLuGMhwKgFVf0=; b=fFhpYh7BUSAOKe2qAFogLfezINrqXqsYc0KiOw0rkVc7tPfh9PQkd3XMVDIMG1FC5k 82EdQk1s93mc5HcBYWJ9sprUOttrRW/cfRrnH5mV+i2O29nlWSJ8683n4q6MXrU76jL9 o0TBfEZqTdR/NF4wTrilHaxmnFxRQye5rOKvTumevE3iys5bzjyUYRX0gBl9qyvomksf i30GiBAmtgr8wNiZAl89cwF3c3ekiQDUra31hru/VKTocodizAooXQSbmkTAwlfeQ7gj v3BU4fJmdI1FS+HTDbNwpva1yX3LrNgdSZ2sjRI48fEzXdN7fwmEsiu/OUiKJjNhsZFr V3Tw== Received: by 10.112.85.195 with SMTP id j3mr4706926lbz.101.1343313758361; Thu, 26 Jul 2012 07:42:38 -0700 (PDT) Received: from mptpmbp2.local (87-236-95-165.customer.universal.se. [87.236.95.165]) by mx.google.com with ESMTPS id j5sm5242072lbg.1.2012.07.26.07.42.31 (version=SSLv3 cipher=OTHER); Thu, 26 Jul 2012 07:42:36 -0700 (PDT) Message-ID: <50115756.6000109@engene.se> Date: Thu, 26 Jul 2012 16:42:30 +0200 From: Marcus Engene User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: planner, *_collapse_limit Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQnz+69YvR2PWVGMZocCUpitU4YlISsTquT/sM2lG165IPWCPBhaDpvK7rl4i5iaKWkM/HaZ X-Pg-Spam-Score: -2.6 (--) X-Archive-Number: 201207/341 X-Sequence-Number: 47522 Hi, I've read a little bit about join_collapse_limit and from_collapse_limit and I see their reason to exist. A stupid question: in algorithms 101 you're usually told to make a chess program and then you usually do a width first min max tree. A low level opponent would interrupt this possibly infinite traversal early, thus returning a possibly bad move, and if it's on a higher level it's allowed to work longer and it will likely present a better path in the tree. I understood it as that the *_collapse_limits are to stop a worst case join making the optimizer going haywire, but it feels sad that trivial big joins are cut off even if they're not too nasty. Why would it not make some sense to have some time/space constraint on the join heuristics instead of/in combination to how the limit presently work? If we hit the ceiling, the best produced plan so far is used. The chess analogy would obviously be a handful chess pieces left but the min-max-tree traversal constraint is on a low depth (rather than time/memory) so it would quickly traverse the few options and then be constrained. Best regards, Marcus