Re: How to select avg(select max(something) from ...)

2025-02-18 Thread Greg Sabino Mullane
Another variation: select avg(max) from (select distinct max(val) over(partition by id) from mytable); Cheers, Greg -- Crunchy Data - https://www.crunchydata.com Enterprise Postgres Software Products & Tech Support

Re: How to select avg(select max(something) from ...)

2025-02-18 Thread Adrian Klaver
On 2/18/25 12:56, dfgpostgres wrote: Hi: psql 15.3 I have a table with sets of observations, each set sharing an id. I want to get the average of the max of each set. id  |  val --- 1     5.0 1     4.3 1     3.8 2     4.8 2     6.0 2     2.9 3     4.1 3     4.4 3     8.0 So I want the

Re: How to select avg(select max(something) from ...)

2025-02-18 Thread David Rowley
On Wed, 19 Feb 2025 at 09:56, dfgpostgres wrote: > So I want the avg of the max of the set where id=1 (5.0), where id=2 (6.0), > where id=3 (8.0) ~= 6.33... > > I tried this... > > select > avg(x.maxsz) >from > dvm.dvm_events d, >

How to select avg(select max(something) from ...)

2025-02-18 Thread dfgpostgres
Hi: psql 15.3 I have a table with sets of observations, each set sharing an id. I want to get the average of the max of each set. id | val --- 1 5.0 1 4.3 1 3.8 2 4.8 2 6.0 2 2.9 3 4.1 3 4.4 3 8.0 So I want the avg of the max of the set where id=1 (5

Re: Doubts regarding pg_freespacemap extension

2025-02-18 Thread Adrian Klaver
On 2/17/25 07:12, Rucha Kulkarni wrote: Hi PostgreSQL Community, While exploring the pg_freespacemap extension, I came across a few doubts and would appreciate any insights or clarifications: 3. Whenever I check the values for B-tree indexes, I observe all values to be 0. From here: http

Doubts regarding pg_freespacemap extension

2025-02-18 Thread Rucha Kulkarni
Hi PostgreSQL Community, While exploring the pg_freespacemap extension, I came across a few doubts and would appreciate any insights or clarifications: 1. In the code, it defines NonLeafNodesPerPage as (BLCKSZ / 2 - 1) as can be seen here: https://github.com/postgres/postgres/blob/master/src/in