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

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: 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>
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 08:19:05
Message-ID: 1523953145.2361.2.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Bob Jones wrote:
> 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.

That's fine.

A top-1-sort is less work than you maybe think:
You go through all items and find the biggest one.
So there is one comparison operator per row - very similar to
what happens when "grepping" for NULL values.

Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Gao Jack 2018-04-17 09:12:10 RE: pg_dump to a remote server
Previous Message Ron 2018-04-17 07:35:21 Re: pg_dump to a remote server