<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; font-size: 12pt;">
Eric,</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; font-size: 12pt;">
<br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; font-size: 12pt;">
That is interesting.</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; font-size: 12pt;">
<br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; font-size: 12pt;">
Viewing the pgpointcloud source code it looks like the method pcpoint_get_value (pc_access.c line 66) implement the PC_Get function. It appears this method will deserialize the patch data for each invocation via the pc_point_deserialize method. Deserializing
 a patch might be an "expensive" operation.</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; font-size: 12pt;">
<br>
</div>
<hr tabindex="-1" style="width: 98%; display: inline-block;">
<div id="divRplyFwdMsg" dir="ltr"><font color="#000000" face="Calibri, sans-serif" style="font-size: 11pt;"><b>Fra:</b> Éric Lemoine <eric.lemoine@oslandia.com><br>
<b>Sendt:</b> 9. mai 2018 12:41<br>
<b>Til:</b> Regina Obe; 'Lars'; pgpointcloud@lists.osgeo.org<br>
<b>Emne:</b> Re: [pgpointcloud] PC_Get array of dimensions</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size: 11pt;">
<div class="PlainText">On Wed, 2018-05-09 at 04:22 -0400, Regina Obe wrote:<br>
> That's surprising.  It should have had a significant performance gain<br>
>  though it's possible the PostgreSQL 10 rewrote your original so it<br>
> ends up following the lateral construct.<br>
> I think older versions just end up calling PC_Explode multiple times.<br>
<br>
<br>
It looks like there is a significant per-PC_Get cost:<br>
<br>
lopocs=# /timing<br>
lopocs=# select pc_get(pae, 'x') from (select pc_explode(points) pae<br>
from inrap limit 100000) t;<br>
Time: 225.342 ms<br>
lopocs=# select pc_get(pae, 'x'), pc_get(pae, 'y') from (select<br>
pc_explode(points) pae from inrap limit 100000) t;<br>
Time: 331.342 ms<br>
lopocs=# select pc_get(pae, 'x'), pc_get(pae, 'y'), pc_get(pae, 'z')<br>
from (select pc_explode(points) pae from inrap limit 100000) t;<br>
Time: 426.759 ms<br>
lopocs=# select pc_get(pae, 'x'), pc_get(pae, 'y'), pc_get(pae, 'z'),<br>
pc_get(pae, 'NumberOfReturns'), pc_get(pae, 'Classification'),<br>
pc_get(pae, 'UserData'), pc_get(pae, 'PointSourceId'), pc_get(pae,<br>
'Green'), pc_get(pae, 'Red'), pc_get(pae, 'Blue'), pc_get(pae,<br>
'GpsTime') from (select pc_explode(points) pae from inrap limit 100000)<br>
t;<br>
Time: 926.485 ms<br>
<br>
I use Postgres 9.6.5 in these tests.<br>
<br>
<br>
-- <br>
Éric Lemoine<br>
Oslandia<br>
+33 1 86 95 95 55</div>
</span></font></div>
</body>
</html>