Re: To prefer sorts or filters in postgres, that is the question....

From: Bob Jones <r(dot)a(dot)n(dot)d(dot)o(dot)m(dot)d(dot)e(dot)v(dot)4+postgres(at)gmail(dot)com>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: To prefer sorts or filters in postgres, that is the question....
Date: 2018-04-17 07:05:50
Message-ID: CA+HuS5HOBqysd25njHFrs2oP-cag9VEwetDGqX1T95-da1Pw5A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>
> At a short glance, I'd say that they are pretty much the same.
> The filter and the top-1-sort will both require a single scan through
> the result set and one operation per row found.
> And the recursive queries are pretty similar, right?
>
> Yours,
> Laurenz Albe
> --
> Cybertec | https://www.cybertec-postgresql.com

Thanks Laurenz.

After sending my original message, I did briefly reconsider things.

My current thinking is that the filter is a bit like an "fgrep" and
the sort actually requires memory allocation and some "real work", and
thus I've settled on the filter for now pending experiments with a
larger quantity of data.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gao Jack 2018-04-17 07:08:35 RE: Re:Postgresql with JDK
Previous Message Thomas Kellerer 2018-04-17 07:04:38 Re: Postgresql with JDK