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 1hkHXa-000419-Fw for pgsql-general@arkaria.postgresql.org; Mon, 08 Jul 2019 00:29:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hkHXY-0002ia-7w for pgsql-general@arkaria.postgresql.org; Mon, 08 Jul 2019 00:29:56 +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 1hkHXX-0002iT-Qm for pgsql-general@lists.postgresql.org; Mon, 08 Jul 2019 00:29:55 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hkHXU-0001f9-MW for pgsql-general@lists.postgresql.org; Mon, 08 Jul 2019 00:29:55 +0000 Received: by mail-pf1-x443.google.com with SMTP id q10so6701489pff.9 for ; Sun, 07 Jul 2019 17:29:52 -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=999WXkoK2UNldhTxAXgW2Ljf46lsgsQLfoTX51thiz4=; b=PK1LclhngSJu9BXai9isPSTJJCUAvSOsuhPNEEetCoxf3Ab70yIbCJOFq8+kUtimwG bllRoLV5jaQYWOzNd3STBWqzLXu1K2KtvM7+3TGlCGfHkqYOW9otqs7JBQS8egxesWrT IF/E2JEUqJpzkrT31N+zokvAF70r6Wzb9D69/GMYmh/Z8pqdtscdYNEqtkOBQUtSpICf h/r64nP9nkVHgONife/VNnWtZtzPg2seGVRPTZfPKn0O876NUKQjd8s9kzh3ikHCAJ0P wyTNP3kIihYO/t6gHbKYRHyrp1gqO0gzl2mj/kbw/O4cB77xh5bk0jEr6DG6rqRpfvM4 h8Ug== 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=999WXkoK2UNldhTxAXgW2Ljf46lsgsQLfoTX51thiz4=; b=IGPtBgzps10sg9FKwKTRCRyxHxGp3052cngWIcAk8ulBP78Sr/TWYjE1NwmOZ7vvYW HbzLfu7aMsl2CrCfs8uhfKw2yhgFaP/NtzTohRh8VfeAKaGvnZsnb1YW1V8PNrfcFns7 oK9EDcs2TnPaJhlMHbxO299UnFDRnHXUezXss5T8SHA3EL9ENqWLeK+g+xsAeRiTBLVF BDDOqRAvtv5/A8zCefTr3Q9fZbb84Csc0UqpD/W2wtkp3xjJUdfLIaDQlKnNBzYPaRHl sLyf6f9oSGif468CH9VvWPKKUY2RAmWcxta+Gdz+M3mkVyyDbfsCEsh1ItjFrkXcUP89 gwXg== X-Gm-Message-State: APjAAAWa/J13SvJBO1vZTqsWgV8zuUBBWkrN3HoeKB3a0mEVLXHqiY23 DzHlxsQjV3b/dUEsRP66PxhYoDPZ X-Google-Smtp-Source: APXvYqxfFGR0lIcnCdbNPiVRxy3n+k/tiYZhxTIdptGQL1lCS1t8teWWvEeKq38im+RezYS5CmNvgA== X-Received: by 2002:a63:ff20:: with SMTP id k32mr19874596pgi.445.1562545789855; Sun, 07 Jul 2019 17:29:49 -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 d16sm9552587pgb.4.2019.07.07.17.29.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 07 Jul 2019 17:29:49 -0700 (PDT) From: Rob Sargent Message-Id: <6A86B6C1-F67B-4314-AC78-0AD5100DB978@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_2059200D-0B9A-4012-BD4B-BEA963D90B62" 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:29:47 -0600 In-Reply-To: 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> X-Mailer: Apple Mail (2.3445.104.11) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Apple-Mail=_2059200D-0B9A-4012-BD4B-BEA963D90B62 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > 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. --Apple-Mail=_2059200D-0B9A-4012-BD4B-BEA963D90B62 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

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=_2059200D-0B9A-4012-BD4B-BEA963D90B62--