Re: WHERE ... NOT NULL ... OR ... (SELECT...)

From: "Dickson S(dot) Guedes" <listas(at)guedesoft(dot)net>
To: Mario Splivalo <mario(at)splivalo(dot)hr>
Cc: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: WHERE ... NOT NULL ... OR ... (SELECT...)
Date: 2015-08-24 11:34:12
Message-ID: CAHHcreqvPiTG_GkfHeLBUbjxcRiL0mxEnCrZ=J_n3+kbDVfzeA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

2015-08-23 18:01 GMT-03:00 Mario Splivalo <mario(at)splivalo(dot)hr>:
[...]
> Now, I did 'circumvent' the waiting with using UNION:
>
> valipile=# explain select * from account_analytic_line where move_id in
> (select id from account_move_line) union select * from
> account_analytic_line where move_id is null;

[...]

> Unique (cost=193891.55..212017.84 rows=329569 width=162)
> -> Sort (cost=193891.55..194715.47 rows=329569 width=162)

I'm not answering your original question, but since the queries in your UNION
will be mutually exclusive, you could replace your UNION by UNION ALL to rip off
the Sort+Unique Node.

[]s
--
Dickson S. Guedes
mail/xmpp: guedes(at)guedesoft(dot)net - skype: guediz
http://github.com/guedes - http://guedesoft.net
http://www.postgresql.org.br

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Mario Splivalo 2015-08-24 12:13:02 Re: WHERE ... NOT NULL ... OR ... (SELECT...)
Previous Message Mario Splivalo 2015-08-23 21:01:01 WHERE ... NOT NULL ... OR ... (SELECT...)