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 1hkHZJ-00047x-5M for pgsql-general@arkaria.postgresql.org; Mon, 08 Jul 2019 00:31:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hkHZH-0007ZN-Jq for pgsql-general@arkaria.postgresql.org; Mon, 08 Jul 2019 00:31:43 +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 1hkHZH-0007ZG-8t for pgsql-general@lists.postgresql.org; Mon, 08 Jul 2019 00:31:43 +0000 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hkHZE-0001gt-D7 for pgsql-general@lists.postgresql.org; Mon, 08 Jul 2019 00:31:42 +0000 Received: by mail-pl1-x644.google.com with SMTP id 9so7325004ple.5 for ; Sun, 07 Jul 2019 17:31:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=QnJZ73UttaeKZls1x5SBORxiRC936/cdRtNqepTPcGI=; b=USCxhc72y/u87dXER2QMwpphL5XeMsb97OypetuhV7oVkMxHPqsiiRYm6204CR/N4U eURVC3oUHYHjx5dcjK7zmwXd24jGkf37dLT31LQdjII+9O07vSp2wNy0FKQh2fQpZ5ga GH8Jn5yJ7+7js8i0djZ4NRbZ2mEcy5kEPd1IgiapMknfcZa3vePBooP1AYmjEsn/jvUQ IoTs3RRVur5HW2nhu6JzoruqDOZOTooQ5YYhv7m1XMNcDikLSOruHUFqGC4QLa1B1ogF LK7B9jbE5sGkk3ftd5z2e3IVgvQFHqSjW/xR57UKwuQhfJ6S7qBq/DTJs0y41CHC4kcG Dlrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=QnJZ73UttaeKZls1x5SBORxiRC936/cdRtNqepTPcGI=; b=rx6jSuxJiCa3N9uEFqoNjUkAi7RG2h0+ZFFqNbjTYtFWetRbTtSzrxHj+VMCA1kr+O Eic+vJHL02hWnRts697Yxt+jZR1/I2UY2gZ1aiT7Qew6C1zzu9OTsi8dz4RA4UWwEZA5 h4j5ha69euDrOtEkq0cG4rrTP09+c5c4tZIL96GowFt619cN5Wodb+hGb7B5VDRGta1a yOaCSLzo5eWT7dbG+PxqTrqMheTWv2Eix6TNWjGAaSygFeVdyKSRFzg4TAkj5/UGiOwF QwNWftExgp00r71gIkqyeIu/Wz7+iRx6LFm71o8/ozHvRcsUugVwZaUGQgSTjVDHmsCz C0CQ== X-Gm-Message-State: APjAAAVI9We82H4YpfANBk46HQczvfzvv8fnx7UZwizhdzEwbx5kco8O AzTN4qS+Vv3Evtl13ta8awA= X-Google-Smtp-Source: APXvYqylKkGYI6WF9t9jr8r/em35BYAxy7FQgm4nM8juMco2Rs9IJwhbn4eS2OeuDSNZN75SfbJMTQ== X-Received: by 2002:a17:902:724a:: with SMTP id c10mr19470626pll.298.1562545898372; Sun, 07 Jul 2019 17:31:38 -0700 (PDT) Received: from [192.168.1.108] (c-73-63-59-118.hsd1.ut.comcast.net. [73.63.59.118]) by smtp.gmail.com with ESMTPSA id o95sm14719143pjb.4.2019.07.07.17.31.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 07 Jul 2019 17:31:37 -0700 (PDT) From: Rob Sargent Message-Id: Content-Type: multipart/alternative; boundary="Apple-Mail=_39E6A58E-058F-4953-969B-A640A9764F50" Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: Measuring the Query Optimizer Effect: Turning off the QO? Date: Sun, 7 Jul 2019 18:31:36 -0600 In-Reply-To: <6A86B6C1-F67B-4314-AC78-0AD5100DB978@gmail.com> Cc: "pgsql-general@lists.postgresql.org" To: Tom Mercha References: <6E1859C3-4453-4AC2-ABE9-C4F40E5CCDC0@gmail.com> <9F86AE55-36AC-461C-87C9-34C11C734491@gmail.com> <10CEE386-C195-4864-AF30-7DEE90E9DFF3@gmail.com> <6A86B6C1-F67B-4314-AC78-0AD5100DB978@gmail.com> X-Mailer: Apple Mail (2.3445.104.11) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Apple-Mail=_39E6A58E-058F-4953-969B-A640A9764F50 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Jul 7, 2019, at 6:29 PM, Rob Sargent wrote: >=20 >=20 >=20 >> O >>>>>> Sorry, maybe my question wasn't clear enough. >>>>>>=20 >>>>>> A query can be rewritten in various ways by applying rules and = costs of >>>>>> relational algebra operators, as well as their parallelisation. I = am >>>>>> talking about turning off this query optimization, so I am = already >>>>>> assuming that indexes aren't present. >>>>>=20 >>>>> Have you played with any of these settings? >>>>>=20 >>>>> postgres=3D# select version(); >>>>> version >>>>> = --------------------------------------------------------------------------= ------------------------------- >>>>> PostgreSQL 10.7 on x86_64-pc-linux-gnu, compiled by gcc (GCC) = 4.8.5 20150623 (Red Hat 4.8.5-36), 64-bit >>>>> (1 row) >>>>>=20 >>>>> postgres=3D# select name, setting, unit,short_desc from = pg_settings where name ~ 'para'; >>>>> name | setting | unit | = short_desc >>>>> = ---------------------------------+---------+------+-----------------------= --------------------------------------------------------------------------= --- >>>>> force_parallel_mode | off | | Forces use of = parallel query facilities. >>>>> max_parallel_workers | 16 | | Sets the = maximum number of parallel workers that can be active at one time. >>>>> max_parallel_workers_per_gather | 8 | | Sets the = maximum number of parallel processes per executor node. >>>>> min_parallel_index_scan_size | 64 | 8kB | Sets the = minimum amount of index data for a parallel scan. >>>>> min_parallel_table_scan_size | 1024 | 8kB | Sets the = minimum amount of table data for a parallel scan. >>>>> parallel_setup_cost | 1000 | | Sets the = planner's estimate of the cost of starting up worker processes for = parallel query. >>>>> parallel_tuple_cost | 0.1 | | Sets the = planner's estimate of the cost of passing each tuple (row) from worker = to master backend. >>>>> ssl_dh_params_file | | | Location of = the SSL DH parameters file. >>>>> (8 rows) >>>>>=20 >>>> Well not the last one of course. >>>=20 >>> Better yet, =E2=80=9Cwhere category ~* =E2=80=98planner=E2=80=99" >>>=20 >>=20 >> Hi >>=20 >> Yes, I've taken a look. I'm just interested in turning off the whole=20= >> module and there is no parameter to do just that - an on and off = switch=20 >> - from what I can understand. What I can do instead is to go over the=20= >> entire list of parameters and configure them each to generate a bad=20= >> plan, but I'm not sure in general how to make a configuration which=20= >> gives me the worst plan possible under all situations. >>=20 >> I was hoping that someone has the on/off switch I'm looking for or a=20= >> parameter template which has been used for the same purpose or = something=20 >> along these lines... >>=20 >> This document describes the module I'm talking about:=20 >> https://www.postgresql.org/docs/current/planner-optimizer.html = > Yeah, I guess I read that to say postgres will optimize generically = (after geqo_threshold). Now maybe that=E2=80=99s the worst plan? Per = force a lot of seq-scans in the absence of any indices. And if it = isn=E2=80=99t the worst possible plan, so what, you=E2=80=99re using = postgres, you won=E2=80=99t get a worse plan without lying to the = optimizer. > But I=E2=80=99m clearly in over my head. The pros will be along = shortly, I=E2=80=99m sure. And I didn=E2=80=99t notice I had pasted a url to a git project. Totally = irrelevant to the issue at hand. My apologies. --Apple-Mail=_39E6A58E-058F-4953-969B-A640A9764F50 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On Jul 7, 2019, at 6:29 PM, Rob Sargent <robjsargent@gmail.com> wrote:



O
Sorry, = maybe my question wasn't clear enough.

A = query can be rewritten in various ways by applying rules and costs of
relational algebra operators, as well as their = parallelisation. I am
talking about turning off this query = optimization, so I am already
assuming that indexes aren't = present.

Have you played with = any of these settings?

postgres=3D# select = version();
          &nb= sp;            = ;            &= nbsp;           &nb= sp; version
---------------------------------------------------------------= ------------------------------------------
 PostgreSQL = 10.7 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red = Hat 4.8.5-36), 64-bit
(1 row)

postgres=3D# select name, setting, unit,short_desc from = pg_settings where name ~ 'para';
          &nb= sp;   name =             &n= bsp; | setting | unit | =             &n= bsp;           &nbs= p;            =        short_desc
---------------------------------+---------+------+------------= --------------------------------------------------------------------------= --------------
 force_parallel_mode =             | = off     |      | Forces use = of parallel query facilities.
 max_parallel_workers =            | 16 =      |      | Sets the = maximum number of parallel workers that can be active at one time.
 max_parallel_workers_per_gather | 8 =       |      | = Sets the maximum number of parallel processes per executor node.
 min_parallel_index_scan_size    | 64 =      | 8kB  | Sets the minimum amount of = index data for a parallel scan.
 min_parallel_table_scan_size    | 1024 =    | 8kB  | Sets the minimum amount of table data = for a parallel scan.
 parallel_setup_cost =             | = 1000    |      | Sets the = planner's estimate of the cost of starting up worker processes for = parallel query.
 parallel_tuple_cost =             | = 0.1     |      | Sets the = planner's estimate of the cost of passing each tuple (row) from worker = to master backend.
 ssl_dh_params_file =             &n= bsp;|         | =      | Location of the SSL DH parameters = file.
(8 rows)

Well not the last one of course.

Better yet, =E2=80=9Cwhere = category ~* =E2=80=98planner=E2=80=99"


Hi

Yes, = I've taken a look. I'm just interested in turning off the whole 
module and there is no = parameter to do just that - an on and off switch 
- from what I can = understand. What I can do instead is to go over the 
entire list of = parameters and configure them each to generate a bad 
plan, but I'm not sure = in general how to make a configuration which 
gives me the worst plan = possible under all situations.

I was = hoping that someone has the on/off switch I'm looking for or a 
parameter template which = has been used for the same purpose or something 
along these = lines...

This = document describes the module I'm talking about: 
https://www.postgresql.org/docs/current/planner-optimizer.html<= /a>




= --Apple-Mail=_39E6A58E-058F-4953-969B-A640A9764F50--