<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<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,EmojiFont,'Apple Color Emoji','Segoe UI Emoji', NotoColorEmoji,'Segoe UI Symbol','Android Emoji',EmojiSymbols; font-size: 12pt;">
You suggestion improved performance by factor of 20. Thank you <span>😊</span></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;">
Maybe consider adding indexing command to pgpointcloud website.</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> 2. mai 2018 15:23<br>
<b>Til:</b> Lars; pgpointcloud@lists.osgeo.org<br>
<b>Emne:</b> Re: [pgpointcloud] PC_Intersects and indexing</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size: 11pt;">
<div class="PlainText">On Wed, 2018-05-02 at 12:01 +0000, Lars wrote:<br>
> Hello,<br>
> <br>
> Used PDAL (1.7.1) to import xyz data into a PostgresSQL "pointcloud"<br>
> table called "import" with chipper capacity set to 4000. The table<br>
> has about 50,000 rows with more than 2GB of data.<br>
> <br>
> The "import" table contains column id and pa which are of type<br>
> integer and pcpatch respectively. The table is configured with btree<br>
> indexing on the id column.<br>
> <br>
> Running the following query takes 776,952 ms and returns two records.<br>
> select id from import where PC_Intersects(pa,<br>
> st_geomfromtext('POLYGON ((6.9821 25.2525......))', 4326));<br>
> <br>
> The documentation at <a href="https://github.com/pgpointcloud/pointcloud">https://github.com/pgpointcloud/pointcloud</a><br>
> mention using GIST as indexing;<br>
> CREATE INDEX ON import USING GIST(PC_BoundingDiagonalGeometry(pa)<br>
> gist_geometry_ops_nd);<br>
<br>
PC_Intersects uses PC_EnvelopeGeometry so you index should be based on<br>
that function instead of PC_BoundingDiagonalGeometry:<br>
<br>
CREATE INDEX ON patches USING GIST(PC_EnvelopeGeometry(pa));<br>
<br>
> <br>
> So we drop btree and add gist indexing, run the same query takes<br>
> 796,384 ms and return the two same records.<br>
<br>
You did not need to drop the btree index on the id column, but you may<br>
not need to keep neither :)<br>
<br>
<br>
-- <br>
Éric Lemoine<br>
Oslandia</div>
</span></font></div>
</body>
</html>