Search Postgresql Archives

Re: hstore each() function - returned order??

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: David G. Johnston <david.g.johnston@xxxxxxxxx>
Sent: Friday, March 12, 2021 21:19
To: Brent Wood <Brent.Wood@xxxxxxxxxx>
Cc: pgsql-general@xxxxxxxxxxxxxxxxxxxx <pgsql-general@xxxxxxxxxxxxxxxxxxxx>
Subject: Re: hstore each() function - returned order??
 

Thanks David,

Is this what you mean?

select measurement_key,
       value
from t_reading_hstore,
     lateral ((EACH(value)).key as measurement_key,
     lateral ((EACH(value)).value as value;

I'll try it with \timing & explain to look at performance, but I don't see how this provides any greater assurance that the keys & values are provided in the same order, and so the correct value is in the same row as its key?

This still seems to depend on just how the EACH() function returns the values rather than any use of lateral joins, and was the question I was asking.

Cheers

Brent Wood

On Thursday, March 11, 2021, Brent Wood <Brent.Wood@xxxxxxxxxx> wrote:
Hi,

I'm using the following in an SQL :

select (EACH(value)).key as measurement_key,
       (EACH(value)).value as value
from t_reading_hstore;


Just move the each call to the from clause as a lateral join and treat the result as a two-column table.

David J. 




Brent Wood
Principal Technician - GIS and Spatial Data Management
Programme Leader - Environmental Information Delivery
+64-4-386-0529
National Institute of Water & Atmospheric Research Ltd (NIWA)
301 Evans Bay Parade Hataitai Wellington New Zealand
Connect with NIWA: niwa.co.nz Facebook LinkedIn Twitter Instagram
To ensure compliance with legal requirements and to maintain cyber security standards, NIWA's IT systems are subject to ongoing monitoring, activity logging and auditing. This monitoring and auditing service may be provided by third parties. Such third parties can access information transmitted to, processed by and stored on NIWA's IT systems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux