Re: select count(*); - Mailing list pgsql-general

From Adrian Klaver
Subject Re: select count(*);
Date
Msg-id 55799B89.2010902@aklaver.com
Whole thread Raw
In response to Re: select count(*);  (Marc Mamin <M.Mamin@intershop.de>)
Responses Re: select count(*);
List pgsql-general
On 06/11/2015 07:17 AM, Marc Mamin wrote:
>>> That's the point. * has no meaning without FROM
>
>
>> But COUNT(*)
>>
>> does have meaning - it means "the number of rows".
>
> which rows? :-)

To follow up on the post from Chris Mair:

test=> select count(*), 'foo';
  count | ?column?
-------+----------
      1 | foo

See also:

http://www.postgresql.org/docs/9.4/interactive/functions-aggregate.html


count(*)           bigint     number of input rows
>
>> It's not counting the number of columns in the row, so postgres doesn't need to know what columns exist in the row
toreturn a row count. 
>
>> Geoff
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


pgsql-general by date:

Previous
From: Francisco Olarte
Date:
Subject: Re: select count(*);
Next
From: Marc Mamin
Date:
Subject: Re: select count(*);