Re: Zero throughput on a query on a very large table. - Mailing list pgsql-performance

From ldh@laurent-hasson.com
Subject Re: Zero throughput on a query on a very large table.
Date
Msg-id BN6PR15MB1185CC28C1DF4B94A6FAD2CC859B0@BN6PR15MB1185.namprd15.prod.outlook.com
Whole thread Raw
In response to Re: Zero throughput on a query on a very large table.  ("ldh@laurent-hasson.com" <ldh@laurent-hasson.com>)
Responses Re: Zero throughput on a query on a very large table.  ("ldh@laurent-hasson.com" <ldh@laurent-hasson.com>)
Re: Zero throughput on a query on a very large table.  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-performance

OK... I think we may have cracked this.


First, do you think that 128MB work_mem is ok? We have a 64GB machine and expecting fewer than 100 connections. This is really an ETL workload environment at this time.


Second, here is what i found and what messed us up.

    select current_setting('random_page_cost'); --> 4

    alter database "CMS_TMP" set random_page_cost=0.00000001;
    select current_setting('random_page_cost'); --> 4 ????

I also tried:
    select current_setting('random_page_cost'); --> 4
    select set_config('random_page_cost', '0.000001', true);
    select current_setting('random_page_cost'); --> 4 ????

Is there something that is happening that is causing those settings to not stick? I then tried:


    select current_setting('random_page_cost'); --> 4
    select set_config('random_page_cost', '0.000001', false); -- false now, i.e., global
    select current_setting('random_page_cost'); --> 0.000001 !!!!

So i think we just spent 4 days on that issue. I then did

    select set_config('enable_seqscan', 'off', false);
And the plan is now using an index scan, and we are getting 12K rows/s in throughput immediately!!! 😊

So i guess my final question is that i really want to only affect that one query executing, and i seem to not be able to change the settings used by the planner just for that one transaction. I have to change it globally which i would prefer not to do. Any help here?

Thanks,

Laurent.


From: ldh@laurent-hasson.com <ldh@laurent-hasson.com>
Sent: Friday, January 25, 2019 1:36:21 PM
To: Tom Lane
Cc: pgsql-performance@postgresql.org
Subject: Re: Zero throughput on a query on a very large table.
 

Sorry :) When i look at the "SQL" tab in PGAdmin when i select the index in the schema browser. But you are right that /d doesn't show that.


From: Tom Lane <tgl@sss.pgh.pa.us>
Sent: Friday, January 25, 2019 1:34:01 PM
To: ldh@laurent-hasson.com
Cc: pgsql-performance@postgresql.org
Subject: Re: Zero throughput on a query on a very large table.
 
"ldh@laurent-hasson.com" <ldh@laurent-hasson.com> writes:
> Also, the original statement i implemented did not have all of that. This is the normalized SQL that Postgres now gives when looking at the indices.

[ squint... ]  What do you mean exactly by "Postgres gives that"?
I don't see any redundant COLLATE clauses in e.g. psql \d.

                        regards, tom lane

pgsql-performance by date:

Previous
From: "ldh@laurent-hasson.com"
Date:
Subject: Re: Zero throughput on a query on a very large table.
Next
From: "ldh@laurent-hasson.com"
Date:
Subject: Re: Zero throughput on a query on a very large table.