Re: Tricking the optimizer - Mailing list pgsql-general

From Vitaliy Garnashevich
Subject Re: Tricking the optimizer
Date
Msg-id 18bb3d30-a96c-f91b-3e42-45bb3527dd64@gmail.com
Whole thread Raw
In response to Re: Tricking the optimizer  (Vitaliy Garnashevich <vgarnashevich@gmail.com>)
List pgsql-general
We've tried to use "... WHERE coalesce(...)::bool;" on a test query:

Before:
->  Seq Scan on public.sys_user sys_user_1  (cost=0.00..27140.46 rows=1 
width=16) (actual time=0.105..38.627 rows=3289 loops=1)
       Filter: (((SubPlan 7) = 0) AND ((SubPlan 8) = 0) AND ((SubPlan 9) 
= 0))

After:
->  Seq Scan on public.sys_user sys_user_1  (cost=0.00..27140.46 
rows=1790 width=16) (actual time=0.136..28.413 rows=3289 loops=1)
       Filter: COALESCE((((SubPlan 7) = 0) AND ((SubPlan 8) = 0) AND 
((SubPlan 9) = 0)))

The estimate got closer to the actual number of rows.

Regards,
Vitaliy


pgsql-general by date:

Previous
From: greigwise
Date:
Subject: postgres on physical replica crashes
Next
From: Adrian Klaver
Date:
Subject: New website