pg.ddx.io pgsql-general@postgresql.org mailing list archivehelp / color / mirror / Atom feed
From: Rob Sargent <robjsargent@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: ***SPAM*** Re: Can I get the number of results plus the results with a single query?
Date: Mon, 15 Aug 2022 16:13:49 -0600
Message-ID: <a9e48f38-93b6-89b4-34c2-3b34bd6732b8@gmail.com> (raw)
In-Reply-To: <8D4B16FB-BE56-446E-BDE5-D12C69B2C3DB@easesoftware.com>
References: <75BBE3C5-D495-47B8-A81C-6359391E3B99@easesoftware.com>
<CAKFQuwYR-kmTsRJDQ-2US_KR1jvjORceUMsO5jv9duZBrtZqwg@mail.gmail.com>
<8D4B16FB-BE56-446E-BDE5-D12C69B2C3DB@easesoftware.com>
On 8/15/22 14:37, Perry Smith wrote:
>
>
>> On Aug 15, 2022, at 08:55, David G. Johnston
>> <david.g.johnston@gmail.com> wrote:
>>
>> On Monday, August 15, 2022, Perry Smith <pedz@easesoftware.com> wrote:
>>
>> I’ve been toying with row_number() and then sort by row_number
>> descending and pick off the first row as the total number.
>>
>>
>> Use count as a window function.
>
> I see others are commenting after David’s update so:
>
> Thank you David.
>
> This seems to work for me:
>
> SELECT count(*) OVER (), id, basename, sha1 FROM dateien WHERE
> (lower(ext) in ( 'pxd' ) and ftype = 'file') ORDER BY sha1;
>
>
> This has, e.g. 73, in the first column for all of the rows.
>
Any comparative timing statistics on that? Especially on more than 73
records returned, because with that few just grab them all and get
size() or length of what ever collection mechanism you're playing with.
view thread (4+ messages) latest in thread
Message-ID: <a9e48f38-93b6-89b4-34c2-3b34bd6732b8@gmail.com> Permalink: ../a9e48f38-93b6-89b4-34c2-3b34bd6732b8@gmail.com/ Also on: postgresql.org/message-id/a9e48f38-93b6-89b4-34c2-3b34bd6732b8@gmail.com ·
reply
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Reply to all the recipients from your mail client; the link fills in the headers below: reply via email Some clients, webmail especially, drop In-Reply-To and References from a link, and the reply then starts a new thread: use the mbox below. To: pgsql-general@postgresql.org Cc: robjsargent@gmail.com Subject: Re: ***SPAM*** Re: Can I get the number of results plus the results with a single query? In-Reply-To: <a9e48f38-93b6-89b4-34c2-3b34bd6732b8@gmail.com> References: <75BBE3C5-D495-47B8-A81C-6359391E3B99@easesoftware.com> <CAKFQuwYR-kmTsRJDQ-2US_KR1jvjORceUMsO5jv9duZBrtZqwg@mail.gmail.com> <8D4B16FB-BE56-446E-BDE5-D12C69B2C3DB@easesoftware.com> <a9e48f38-93b6-89b4-34c2-3b34bd6732b8@gmail.com> * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox
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