Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iQaLP-00072q-I9 for pgsql-hackers@arkaria.postgresql.org; Fri, 01 Nov 2019 17:04:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iQaLN-0007wJ-1o for pgsql-hackers@arkaria.postgresql.org; Fri, 01 Nov 2019 17:04:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iQaLM-0007wC-PH for pgsql-hackers@lists.postgresql.org; Fri, 01 Nov 2019 17:04:12 +0000 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iQaLJ-0002Zs-Sy for pgsql-hackers@postgresql.org; Fri, 01 Nov 2019 17:04:12 +0000 Received: by mail-wm1-x32d.google.com with SMTP id c22so9652276wmd.1 for ; Fri, 01 Nov 2019 10:04:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ddP21zFOucFbiVWrHf+QD8G0NTNRfKYC22e60RnbURQ=; b=GxOyPmBOpQ3VnJJgAfHizpLiD9N1Q5Yhd6JCGLqhqtPuvzbnb7dMP7Xo6knKPpN0RV vXwgxFEpVNoQshLej+vPxU9kZ3Zx3UJyE+s53hcoo3JZW8cKxuyJ5l2POy2SYUw+SuB2 FGJeYxouZ5XNorqkg9xfKHYtfyiMmWFqz9pRSmLP0F768N8N9xvqj57gloy2ifA2N18+ h/urxWed34bdDEYyi72rzLftK9LPXM5/tseygh6EYjwVrxwPKB2EJrHkr+gpq6eaWWqI h0uEbrHBRbTeX1nMjXkK2gcs57EG3XTfCqJAL+zDf/AKZMIH9o01JJo6q8JhMk1GULxK Ab7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ddP21zFOucFbiVWrHf+QD8G0NTNRfKYC22e60RnbURQ=; b=Hv4fFeppqNVQ1y5RBURUrqDdxDLy4NZnOmTp+npyv3uPr52JYdE8qCwATZt4/5J+A1 IE/MY1dXoDqRBVhwW8K6YPimEHdiRDuSCInOUO9i/wjnfNwIgCDjFj8UJ13qE5QvGpIk rv3xjIKYvzDI8Gl/gErDyCca2mrKO/6qY4ljoUVYckhrO3mrr4jkb6cTMvEHSqT9MjOt sB5dqrKs7HjH9rttqGl+M1CHFv7litj3Db73qXFCsW2PVD7kA0oEuDnlc1pzOibSjpey dIcSygVbR58CMtdJlN+XaKCFF7+8N2J8ErI3rL4+0XpcFRnonmALjQvc++fu9s7zFPQS iHsg== X-Gm-Message-State: APjAAAWKEurgXwl/S3Q0YdGwZ4qZVNdFcccjOvT5WTG8TdJlJ78QHAFT uoVqgADhL8zQDdmM/rREmcqXgw== X-Google-Smtp-Source: APXvYqxXS08yDXjw8ln6og9v1T/8VScgQCLxnSZGDhrHGw2fj/cLgYG2twmKhzpNQOcVo8cBOjphpA== X-Received: by 2002:a1c:9646:: with SMTP id y67mr10860132wmd.79.1572627848600; Fri, 01 Nov 2019 10:04:08 -0700 (PDT) Received: from localhost (ip-86-49-253-183.net.upcbroadband.cz. [86.49.253.183]) by smtp.gmail.com with ESMTPSA id b3sm8615397wrv.40.2019.11.01.10.04.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2019 10:04:07 -0700 (PDT) Date: Fri, 1 Nov 2019 18:04:06 +0100 From: Tomas Vondra To: Jim Finnerty Cc: pgsql-hackers@postgresql.org Subject: Re: On disable_cost Message-ID: <20191101170406.w6ybnafyvpxv2ltg@development> References: <20191101160038.wn3qkvp4psnatmm3@alap3.anarazel.de> <1572625852934-0.post@n3.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <1572625852934-0.post@n3.nabble.com> User-Agent: NeoMutt/20180716 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Fri, Nov 01, 2019 at 09:30:52AM -0700, Jim Finnerty wrote: >re: coping with adding disable_cost more than once > >Another option would be to have a 2-part Cost structure. If disable_cost is >ever added to the Cost, then you set a flag recording this. If any plans >exist that have no disable_costs added to them, then the planner chooses the >minimum cost among those, otherwise you choose the minimum cost path. > Yeah, I agree having is_disabled flag, and treat all paths with 'true' as more expensive than paths with 'false' (and when both paths have the same value then actually compare the cost) is probably the way forward. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services