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 1hkH9U-0003Eo-L0 for pgsql-general@arkaria.postgresql.org; Mon, 08 Jul 2019 00:05:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hkH9T-0005Cu-DO for pgsql-general@arkaria.postgresql.org; Mon, 08 Jul 2019 00:05:03 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hkH9S-0005Cn-Qb for pgsql-general@lists.postgresql.org; Mon, 08 Jul 2019 00:05:03 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hkH9Q-0001YD-4p for pgsql-general@lists.postgresql.org; Mon, 08 Jul 2019 00:05:01 +0000 Received: by mail-pg1-x541.google.com with SMTP id q4so6721550pgj.8 for ; Sun, 07 Jul 2019 17:04:59 -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=Iyw5YB8cUpMGew+1X0HU6l8dvMsv1/sl6axlfeSd+C8=; b=nPHBP6KSErjEtWbio/iMficKzFf0LZLB7ayXICA93mLmlV0FD43Ix1RBlJlmH7csS5 ErY1gm7VyeXn94tNvi5cQSqFIo9RaziOuoLfAXu8NUrRp6+nz/cUR2gPMtiO+PyuavOS bgjbE9R9HCN84N/4WOk8DbFR0kgg40RrVlOCRWQYeQa1ZVcbgdd00Az62v+CNFMA1Tp2 HnpfxNKvkoMGQIC/iriLnOYCUT04AD2ZUWwPf2spUpXefVy1+qLFtbpE4//7Qb+h7tMW UjhugaeUWzXaVbDUEFvQWt7z4TGtbbXqwxckZg+5fd79exIdNlvQ6uI1AV2Cmv9bc5jt 2djA== 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=Iyw5YB8cUpMGew+1X0HU6l8dvMsv1/sl6axlfeSd+C8=; b=HpUxSEDUCYYY4rK82uTlJZYZeHV+MoXDjcp/sqrSmoFBpLtAlbGB5X5z+u1lpfjl3M I/k2vBpK8cjRps+SNUF711RX5NxK/gc1BjzjAEMckDuaPDH854QcH3UyGcz2q4BeC8X6 XLJwcKkfXmMOnZ+QcuNJ9MxiC+bTRMBybdUyxQ/kHBsCVqv1I5ZBlMthDMa58nx2P0iR T0rbLtC8NDKKZzUJReCeQWzoKVWy7SElHgzhXf0qu8mhGcK1Ec1VilmEPec0EWgHTMzI MWzb22IcY1LZ+FrLSHOl/CUYUzBNnsFFm7KIV6qnm/8Kp7I2Q/G52yDs5noHliapGuQZ Bfew== X-Gm-Message-State: APjAAAUyggCa9S0zASXmZilFJygY1EZvRs/aTZsIVZfhGGqWWrgOTzSj hX1I1ujS5TtX+VgnrbLS9efm2lLO X-Google-Smtp-Source: APXvYqzMcV1zpH60lRKPagtMML6CMsNY0+9lTCVSyWfLR1dTAH2F4DZXDNvtbaBKlV0/9i2DZDOy+g== X-Received: by 2002:a63:1356:: with SMTP id 22mr20110957pgt.160.1562544298956; Sun, 07 Jul 2019 17:04:58 -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 g66sm15939716pfb.44.2019.07.07.17.04.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 07 Jul 2019 17:04:58 -0700 (PDT) From: Rob Sargent Message-Id: Content-Type: multipart/alternative; boundary="Apple-Mail=_01E2265C-1008-4511-8E7A-F0D97E8E9F79" 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:04:57 -0600 In-Reply-To: <10CEE386-C195-4864-AF30-7DEE90E9DFF3@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> X-Mailer: Apple Mail (2.3445.104.11) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Apple-Mail=_01E2265C-1008-4511-8E7A-F0D97E8E9F79 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Jul 7, 2019, at 6:02 PM, Rob Sargent wrote: >=20 >=20 >=20 >> On Jul 7, 2019, at 6:01 PM, Rob Sargent > wrote: >>=20 >>=20 >>=20 >>> On Jul 7, 2019, at 5:49 PM, Tom Mercha > wrote: >>>=20 >>> On 08/07/2019 01:46, Rob Sargent wrote: >>>>=20 >>>>=20 >>>>> On Jul 7, 2019, at 5:22 PM, Tom Mercha > wrote: >>>>>=20 >>>>> Hi All >>>>>=20 >>>>> As we know, a query goes through number of stages before it is = executed. >>>>> One of these stages is query optimization (QO). >>>>>=20 >>>>> There are various parameters to try and influence optimizer = decisions >>>>> and costs. But I wanted to measure the effect of such a stage by = turning >>>>> it off completely and I can't find such a parameter which = explicitly >>>>> does that. Then I could execute a query to get the effect of "QO = active >>>>> and "QO inactive" and compare. >>>>>=20 >>>>> Obviously, I know well what the results would generally look like = but I >>>>> am just interested in measuring the differences for various types = of >>>>> queries. I am also aware that this is a simple comparison - there = are >>>>> https://gitlab.com/camplab/jpsgcs = interesting comparisons to perform = with QO tweaks, but right now I >>>>> am interested in something basic. >>>>>=20 >>>>> So how would one shut down QO? Or at least, obtaining the = guarantee of >>>>> generating the worst plan possible, ideally without touching many >>>>> parameters? >>>>>=20 >>>>> Best, >>>>> Tom >>>>=20 >>>> Drop all indices? >>>>=20 >>>=20 >>> Sorry, maybe my question wasn't clear enough. >>>=20 >>> A query can be rewritten in various ways by applying rules and costs = of=20 >>> relational algebra operators, as well as their parallelisation. I am=20= >>> talking about turning off this query optimization, so I am already=20= >>> assuming that indexes aren't present. >>=20 >> Have you played with any of these settings? >>=20 >> postgres=3D# select version(); >> version = =20 >> = --------------------------------------------------------------------------= ------------------------------- >> 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 = =20 >> = ---------------------------------+---------+------+-----------------------= --------------------------------------------------------------------------= --- >> 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. Better yet, =E2=80=9Cwhere category ~* =E2=80=98planner=E2=80=99"= --Apple-Mail=_01E2265C-1008-4511-8E7A-F0D97E8E9F79 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

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



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



On Jul = 7, 2019, at 5:49 PM, Tom Mercha <mercha_t@hotmail.com> wrote:

On = 08/07/2019 01:46, Rob Sargent wrote:


On Jul 7, 2019, at 5:22 PM, Tom Mercha <mercha_t@hotmail.com> wrote:

Hi All

As we know, a query goes = through number of stages before it is executed.
One of = these stages is query optimization (QO).

There are various parameters to try and influence optimizer = decisions
and costs. But I wanted to measure the effect of = such a stage by turning
it off completely and I can't find = such a parameter which explicitly
does that. Then I could = execute a query to get the effect of "QO active
and "QO = inactive" and compare.

Obviously, I know = well what the results would generally look like but I
am = just interested in measuring the differences for various types of
queries. I am also aware that this is a simple comparison - = there are
https://gitlab.com/camplab/jpsgcs interesting comparisons to = perform with QO tweaks, but right now I
am interested in = something basic.

So how would one shut down = QO? Or at least, obtaining the guarantee of
generating the = worst plan possible, ideally without touching many
parameters?

Best,
Tom

Drop all = indices?


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();
   =                     =                     =       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';
    =           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)

Well not = the last one of course.

Better yet, =E2=80=9Cwhere category ~* = =E2=80=98planner=E2=80=99"
= --Apple-Mail=_01E2265C-1008-4511-8E7A-F0D97E8E9F79--