Re: Postgres chooses slow query plan from time to time

2021-09-16 Thread Kristjan Mustkivi
Understood. Thank you so much for looking into this! Best regards, Kristjan On Wed, Sep 15, 2021 at 5:34 PM Tom Lane wrote: > > Kristjan Mustkivi writes: > > On Wed, Sep 15, 2021 at 3:16 PM Tom Lane wrote: > >> Note the lack of any visible cast on the varchar c

Re: Postgres chooses slow query plan from time to time

2021-09-15 Thread Kristjan Mustkivi
│ plpgsql Version │ 1.0 Schema │ pg_catalog Description │ PL/pgSQL procedural language Plus the some libraries preloaded: shared_preload_libraries = 'pg_stat_statements,pg_cron,auto_explain' Thank you so much for looking into this! Best regards, -- Kristjan Mustkivi Email: kristjan.mustk...@gmail.com

Re: Postgres chooses slow query plan from time to time

2021-09-14 Thread Kristjan Mustkivi
type text? Best regards, Kristjan On Tue, Sep 14, 2021 at 6:47 PM Tom Lane wrote: > > Kristjan Mustkivi writes: > >>> Filter: (((product_code)::text = ($1)::text) AND > >>> ((balance_type)::text = ($4)::text)) > > > But the Primary Key is defi

Re: Postgres chooses slow query plan from time to time

2021-09-14 Thread Kristjan Mustkivi
On Tue, Sep 14, 2021 at 5:15 PM Tom Lane wrote: > > Kristjan Mustkivi writes: > > -> Index Scan Backward using player_balance_history_idx2 on > > mytable pbh (cost=0.70..21639.94 rows=3885 width=66) (actual > > time=5934.153..5934.153 rows=1 loops=1) >

Re: Postgres chooses slow query plan from time to time

2021-09-14 Thread Kristjan Mustkivi
e_player_id, product_code, balance_type FROM myschema.mytable Options: autovacuum_vacuum_scale_factor=0.0, autovacuum_vacuum_threshold=1000 I will investigate the index bloat and if something is blocking the query as suggested by Laurenz Albe. Best, Kristjan On Tue, Sep 14, 2021 at 3:26 PM Jeff Janes w

Re: Postgres chooses slow query plan from time to time

2021-09-14 Thread Kristjan Mustkivi
Jeff Janes wrote: > > On Mon, Sep 13, 2021 at 9:25 AM Kristjan Mustkivi > wrote: > >> >> SELECT >> * >> FROM >> myschema.mytable pbh >> WHERE >> pbh.product_code = $1 >> AND pbh.cage_player_id = $2 >>

Re: Postgres chooses slow query plan from time to time

2021-09-14 Thread Kristjan Mustkivi
ue, right? For testing, I set autovacuum_vacuum_scale_factor = 0.0 and autovacuum_vacuum_threshold = 1 for the table and am now monitoring the behavior. Best regards, Kristjan On Mon, Sep 13, 2021 at 4:50 PM Tomas Vondra wrote: > > On 9/13/21 3:24 PM, Kristjan Mustkivi wrote: >

Postgres chooses slow query plan from time to time

2021-09-13 Thread Kristjan Mustkivi
ter: (modified_time < '2021-09-13 04:00:00+00'::timestamp with time zone) Planning Time: 2.117 ms Execution Time: 8.658 ms I have played around with SET STATISTICS, work_mem and even tried CREATE STATISTICS although there is no functional dependency on the table columns in quest