pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #11803: avoid "distinct" logic if "limit 1" specified
2+ messages / 2 participants
[nested] [flat]

* BUG #11803: avoid "distinct" logic if "limit 1" specified
@ 2014-10-26 21:42 socketpair@gmail.com
  2014-10-28 19:27 ` Re: BUG #11803: avoid "distinct" logic if "limit 1" specified Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: socketpair@gmail.com @ 2014-10-26 21:42 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      11803
Logged by:          Korenberg Mark
Email address:      socketpair@gmail.com
PostgreSQL version: 9.3.1
Operating system:   Linux
Description:        

In other words,

query:
select * from tablename order by id limit 1

and query:
select distinct * from tablename order by id limit 1

should be planned exactly (as if distinct was not specified)
-----------------------
https://github.com/ponyorm/pony/issues/90
http://doc.ponyorm.com/queries.html#comment-1654734639


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #11803: avoid "distinct" logic if "limit 1" specified
  2014-10-26 21:42 BUG #11803: avoid "distinct" logic if "limit 1" specified socketpair@gmail.com
@ 2014-10-28 19:27 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2014-10-28 19:27 UTC (permalink / raw)
  To: socketpair@gmail.com; +Cc: pgsql-bugs

socketpair@gmail.com writes:
> query:
> select * from tablename order by id limit 1

> and query:
> select distinct * from tablename order by id limit 1

> should be planned exactly (as if distinct was not specified)

Seems like a waste of planning cycles to check for this.
The uniquification step isn't going to take enough time to be
an issue, if only one input row arrives.  On the other hand,
the added planning logic would contribute some small overhead
to *every* query using DISTINCT.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2014-10-28 19:27 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-10-26 21:42 BUG #11803: avoid "distinct" logic if "limit 1" specified socketpair@gmail.com
2014-10-28 19:27 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox