Re: Performance of "distinct with limit"

2020-08-29 Thread Klaudie Willis
Thanks for your insight Jeff. Interesting read! K Sent with [ProtonMail](https://protonmail.com) Secure Email. ‐‐‐ Original Message ‐‐‐ On Saturday, August 29, 2020 6:23 PM, Jeff Janes wrote: > On Fri, Aug 28, 2020 at 8:34 AM Klaudie Willis > wrote: > >> No index on n, no. Index

Re: Performance of "distinct with limit"

2020-08-29 Thread Jeff Janes
On Fri, Aug 28, 2020 at 8:34 AM Klaudie Willis < klaudie.wil...@protonmail.com> wrote: > No index on n, no. Index might solve it yes, but it seems to me such a > trivial optimization even without. Obviously it is not. > > QUERY > PLAN > | > >

Re: Performance of "distinct with limit"

2020-08-28 Thread Klaudie Willis
un quickly. Can you share the execution plan > for your query? > > --- > > De: "Klaudie Willis" > Para: "pgsql-general" > Enviadas: Sexta-feira, 28 de agosto de 2020 8:29:58 > Assunto: Performan

Re: Performance of "distinct with limit"

2020-08-28 Thread luis . roberto
Hi, If "n" is indexed, it should run quickly. Can you share the execution plan for your query? De: "Klaudie Willis" Para: "pgsql-general" Enviadas: Sexta-feira, 28 de agosto de 2020 8:29:58 Assunto: Performance of "distinct with limit" H

Performance of "distinct with limit"

2020-08-28 Thread Klaudie Willis
Hi, Ran into this under-optimized query execution. select distinct n from bigtable; -- Lets say this takes 2 minutes select distinct n from bigtable limit 2 -- This takes approximately the same time However, the latter should have the potential to be so much quicker. I checked the same query