Workshop Dubai Cut
Workshop Dubai Cut
Workshop Dubai Cut
Program Agenda
1
Introduction
Loading
Querying
Conclusions
Copyright 2014 Oracle and/or its affiliates. All rights reserved. |
Program Agenda
1
Introduction
Loading
Querying
Conclusions
Copyright 2014 Oracle and/or its affiliates. All rights reserved. |
Introduction
2-year Netherlands eScience research project on Massive Point Clouds
1.
2.
3.
4.
5.
TU Delft:
GIS technology
TU Delft Library
3TU.Datacentrum
TU Delft Shared Service Center ICT
Cooperation with CWI/MonetDB
Introduction
Collection of point cloud data
grows rapidly
Many new applications now
economically viable
Introduction
Evaluation of user requirements
Introduction
Point cloud data management/processing systems
Convert to
Geometries
Georaster
LiDAR loader
Query and Clip
SDO_PC tables
or flat table
Load point
cloud
Flat files
Point Tables
Generate TIN
Generate DEM
TIN tables
Convert to
Geometries
maintenance
Enable efficient routing of railway lines
Solution
Program Agenda
1
Introduction
Loading
Querying
Conclusions
Copyright 2014 Oracle and/or its affiliates. All rights reserved. |
De facto standard
http://www.asprs.org/a/society/com
mittees/standards/LAS_1_4_r13.pdf
12+ attributes
Value
Meaning
Unclassified 1
Ground
Low Vegetation
Medium Vegetation
High Vegetation
Format 0, 1
Building
Format 2, 3: , R, G, B
Water
Format 0 3
10
11
12
Overlap Points 2
13-31
Indexable
LAX (LAStools)
LASX (ESRI)
Future
AHN3 higher resolution
Cyclorama-based photogrammetric
datasets (50x AHN2, and with RGB)
Name
Points
LAS files
Area [km2]
Description
20M
20,165,862
0.4
1.25
TU Delft campus
210M
210,631,597
16
4.0
11.25
2201M
2,201,135,689
153
42.0
125
23090M
23,090,482,455
1,492
440.4
2,000
639478M
639,478,217,460
60,185
11,644.4
40,000
The Netherlands
DBMS counterpart of
GPU for graphics
Copyright 2014 Oracle and/or its affiliates. All rights reserved. |
Fully Redundant
672 TB HC or 200 TB HP
44 TB Flash + compression
Eighth
Quarter
Half
Full
Multi-Rack
nD point cloud:
points in nD space and not per se limited to x,y,z
(n ordinates of point which may also have m attributes)
make fit in future ISO 19107 (as ISO 19107 is under revision).
note: nD point clouds are very generic;
e.g. also cover moving object point data: x,y,z,t (id) series.
Program Agenda
1
Introduction
Loading
Querying
Conclusions
Copyright 2014 Oracle and/or its affiliates. All rights reserved. |
Oracle
Blocks
Flat table
PostgreSQL
Blocks
Flat table
LASTools
MonetDB
Copyright 2014 Oracle and/or its affiliates. All rights reserved. |
Querying:
Global loading:
CLIP_PC function
Incremental loading:
SDO_PC_NN (12.1.0.1)
Blocking methods:
R-Tree
CLIP_PC_GET_MIN_HEIGHT (12.1.0.1)
CREATE_CONTOUR_GEOMETRIES (12.1.0.1)
Hilbert R-Tree
PC BLOB:
n points
(x, y, z, ): 8-byte IEEE doubles (<= 8)
BLK_ID
BLK_EXTENT:
SDO_GEOMETRY
Storage:
Up to 30 Mpts/GB
Compressed LOB: 100 Mpts/GB
POINTS:
BLOB
Query
Query
Requires PostGIS
Storage
Compression: 100 Mpts/GB
Compression+: 200 Mpts/GB
Loading:
Incremental loading
Require good input data spatial organization
Ordered loading (avoid de-clustering)
PC DMS LAStools
Partly commercial:
Some tools free open source
Directly on LAS/LAZ
Storage:
LAS: 53 Mpts/GB
LAZ: 540 Mpts/GB
Indexing
None on Exadata
B-tree on (x, y)
Flexible schema
Con
Queries less scalable on non-Exadata
(< 1 billion pts)
Querying:
Plain old SQL
Range query for rectangles
Distance method for circles
No parallel
Storage: 13 Mpts/GB
Querying:
No native parallel
Loading:
Las2txt + COPY FROM
Bad scaling: Only use for small datasets (< 0.5 . 109)
PC DMS MonetDB
Imprints indexing
Querying:
Parallel
Active development
Storage: 40 Mpts/GB
Loading:
Parallel
Pro
Con
DB blocks
Storage (compression)
Scaling
Indexing
DB functionalities
Complex queries
DB flat
Faster loading/updating
DB functionalities
Dynamic schema
Simple queries
File-based
Storage (LAZ)
Data preparation
Simple queries (if not LAZ)
Limited functionalities
Fixed schema (LAS)
Scaling requires DB help
Program Agenda
1
Introduction
Loading
Querying
Conclusions
Copyright 2014 Oracle and/or its affiliates. All rights reserved. |
Loading
Oracle Blocks Loading Process
CSV
LAS
LASzip
LAZ
Flat table
CREATE_PC (1)
SDO_PC
Loading
Oracle Blocks Loading Process
CSV
LAS
LASzip
LAZ
Flat table
CREATE_PC
SDO_PC
Loading
Oracle Blocks (Hilbert blocking) Create tables
CREATE TABLE AHN_BLCK
TABLESPACE USERS
PCTFREE 0
NOLOGGING
LOB(POINTS)
STORE AS SECUREFILE (TABLESPACE USERS COMPRESS HIGH) AS
SELECT * FROM MDSYS.SDO_PC_BLK_TABLE WHERE 0 = 1;
CREATE TABLE AHN_BASE (
id number,
PC SDO_PC)
TABLESPACE USERS
PCTFREE 0
NOLOGGING;
Loading
Oracle Blocks (Hilbert blocking) Create PC
declare
pc sdo_pc;
begin
pc :=
sdo_pc_pkg.init(
basetable
basecol
blktable
ptn_params
pc_extent
sdo_pc_pkg.create_pc(
inp
=> pc,
inptable
=> 'INPTAB',
clstpcdatatbl => null);
=>
=>
=>
=>
=>
'PCS',
'PC',
'BLOCKS',
'blk_capacity=10000',
mdsys.sdo_geometry(2003, null, null,
mdsys.sdo_elem_info_array(1, 1003, 3),
mdsys.sdo_ordinate_array(289020.90, 4320942.61,
290106.02, 4323641.57)),
0.05,
3,
null,
null,
xmltype(
pc_tol
=>
pc_tot_dimensions =>
pc_domain
=>
pc_val_attr_tables =>
pc_other_attrs
=>
'<opc:sdoPcObjectMetadata
xmlns:opc="http://xmlns.oracle.com/spatial/vis3d/2011/sdovis3d.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
blockingMethod="Hilbert R-tree">
</opc:sdoPcObjectMetadata>'));
Loading
Oracle Blocks (Hilbert blocking) Metadata, Index
Update the SRID of the blocks, drop the staging table and add the blocks index (SQL).
UPDATE AHN_BLCK B SET B.BLK_EXTENT.SDO_SRID = 28992;
DROP TABLE AHN_STAGING;
INSERT INTO USER_SDO_GEOM_METADATA VALUES (
AHN_BLCK,
BLK_EXTENT,
SDO_DIM_ARRAY(
SDO_DIM_ELEMENT(X, [min. X], [max. X],0.0001),
SDO_DIM_ELEMENT(Y, [min. Y], [max. Y],0.0001)),
28992);
CREATE INDEX AHN_BLCK_SIDX
ON AHN_BLCK (BLK_EXTENT)
INDEXTYPE IS MDSYS.SPATIAL_INDEX
PARAMETERS (TABLESPACE=INDX WORK_TABLESPACE=PCWORKLAYER_GTYPE=POLYGON SDO_INDX_DIMS=2
SDO_RTR_PCTFREE=0)
PARALLEL 16;
Loading
Oracle Blocks Loading Process
CSV
LAS
LASzip
LAZ
Flat table
CREATE_PC
SDO_PC
Loading
Oracle Blocks (Hilbert blocking) Incremental Loading
$JDKHOME/bin/java -Xms2048m -classpath //ojdbc6.jar://sdoutl.jar oracle.spatial.util.Las2SqlLdrIndep 1 BLOCKS BLOCK_ID_SEQ
//ahn_bench023090_01.las 10000 jdbc:oracle:thin:@//host:port/sid largepc largepc 100000000
(10K block capacity, 100M pts in memory)
Connecting to jdbc:oracle:thin:@//host:port/sid...
Reading
100,000,000 points...
23.324 s. Sorting:
65.362 s. Writing: 164.608 s
Reading
99,995,084 points...
28.793 s. Sorting:
63.231 s. Writing: 187.621 s
Reading
99,997,274 points...
38.275 s. Sorting: 138.074 s. Writing: 216.841 s
Reading
99,991,996 points...
50.051 s. Sorting: 141.184 s. Writing: 236.634 s
Reading
99,990,636 points...
54.492 s. Sorting: 161.936 s. Writing: 240.436 s
Reading
99,990,636 points...
58.812 s. Sorting: 149.797 s. Writing: 244.515 s
Reading
99,990,637 points...
58.353 s. Sorting: 148.561 s. Writing: 242.785 s
Reading
99,990,638 points...
60.001 s. Sorting: 151.770 s. Writing: 242.187 s
Reading
99,990,639 points...
61.795 s. Sorting: 153.668 s. Writing: 243.461 s
Reading
99,990,640 points...
60.733 s. Sorting: 150.150 s. Writing: 243.077 s
Reading
99,990,641 points...
60.419 s. Sorting: 151.012 s. Writing: 244.065 s
Reading
99,999,834 points...
62.434 s. Sorting: 151.908 s. Writing: 246.490 s
Reading
99,990,124 points...
58.342 s. Sorting: 152.249 s. Writing: 245.693 s
Reading
99,999,835 points...
57.816 s. Sorting: 151.361 s. Writing: 244.788 s
Reading
99,990,145 points...
56.882 s. Sorting: 153.129 s. Writing: 245.248 s
Reading
99,997,246 points...
56.489 s. Sorting: 152.962 s. Writing: 244.226 s
Reading
99,992,320 points...
58.604 s. Sorting: 150.968 s. Writing: 253.848 s
Reading
99,990,606 points...
59.011 s. Sorting: 162.808 s. Writing: 253.697 s
Reading
99,990,607 points...
56.012 s. Sorting: 151.588 s. Writing: 255.625 s
Reading
99,990,608 points...
57.417 s. Sorting: 152.561 s. Writing: 256.142 s
Reading
139,854 points...
0.110 s. Sorting:
0.097 s. Writing:
0.375 s
-----------------------------------------------------------------------------------------Read
2,000,000,000 points... 1,078.165 s. Sorting: 2,854.376 s. Writing: 4,752.362 s
(~ sequential I/O networked drive)
Time elapsed......................... 8,708.131 s
(~ 2h)
Loading
PostgreSQL blocks
Load extensions and create blocks table (SQL):
CREATE
CREATE
CREATE
CREATE
EXTENSION postgis;
EXTENSION pointcloud;
EXTENSION pointcloud_postgis;
TABLE patches (id SERIAL PRIMARY KEY, pa PCPATCH);
Loading
PostgreSQL blocks
<?xml version="1.0" encoding="utf-8"?>
<Pipeline version="1.0">
<Writer type="drivers.pgpointcloud.writer">
<Option name="connection"> host=dbhost dbname=dbname password=dbpass
user=dbuser </Option>
<Option name="table">blocks</Option>
<Option name="srid">SRID</Option>
<Option name="overwrite">false</Option>
<Option name="pcid">1</Option>
<Filter type="filters.chipper">
<Option name="capacity">BlockSize</Option>
<Filter type="filters.cache">
<Option name="max_cache_blocks">1</Option>
<Filter type="filters.selector">
<Option name="keep">
<Options>
<Option name="dimension">X</Option>
<Option name="dimension">Y</Option>
<Option name="dimension">Z</Option>
</Options>
</Option>
<Option name="overwrite_existing_dimensions">false</Option>
GIST(geometry(pa));
<Reader type="drivers.las.reader">
<Option name="filename"> [input LAS file]</Option>
<Option name="spatialreference"> EPSG:SRID</Option>
</Reader>
</Filter>
</Filter>
</Filter>
</Writer>
</Pipeline>
Loading LAStools
Loading
LAStools
Optional tiling (if bad spatial organization)
lastile i *.las o tile.las
Multi-core:
option cores
lassort.exe *las cores 8
lasindex *las cores 8
Scripting
lassort.exe -i [input LASfile] -o [output LASfile]
lasindex -i [output LASfile]
Loading
LAStools (Hybrid: PostgreSQL-PostGIS)
Create DB and table for LAS files extents (SQL).
Loading
Oracle flat (Exadata) Loading Process
CSV
LAS
LASzip
LAZ
Flat table
CREATE_PC
SDO_PC
Loading
Oracle flat (Exadata) SqlLoader from CSV / ASCII
connect sys as sysdba
create or replace directory las_dir as
'/scratch/';
CREATE TABLE lidar_ext (
val_d1 NUMBER,
val_d2 NUMBER,
val_d3 NUMBER,
d
NUMBER)
ORGANIZATION EXTERNAL (
TYPE ORACLE_LOADER
DEFAULT DIRECTORY las_dir
ACCESS PARAMETERS (
RECORDS DELIMITED BY NEWLINE
FIELDS (
val_d1 CHAR(8),
val_d2 CHAR(8),
val_d3 CHAR(8),
d
CHAR(8)))
LOCATION (
'lidar1.txt',
'lidar2.txt',
'lidar3.txt'))
PARALLEL;
more lidar*txt
::::::::::::::
lidar1.txt
::::::::::::::
1
2
3
::::::::::::::
lidar2.txt
::::::::::::::
4
5
6
::::::::::::::
lidar3.txt
::::::::::::::
7
8
9
1
2
3
1
2
3
123
124
125
4
5
6
4
5
6
123
124
125
7
8
9
7
8
9
123
124
125
Loading
Oracle flat (Exadata) Loading Process
CSV
LAS
LASzip
LAZ
Flat table
CREATE_PC
SDO_PC
Loading
Oracle flat (Exadata) SqlLoader from LAS
create directory las_dir as ';
create directory exe_dir as ';
create directory log_dir as ';
grant read on directory las_dir to mdsys;
grant read, execute on directory exe_dir to
mdsys;
grant write on directory log_dir to mdsys;
preprocessor.sh
#!/bin/bash
$JDKHOME/bin/java -classpath /scratch/mhorhamm/sdoutl.jar
oracle.spatial.util.Las2SqlLdr $1
Loading
Oracle flat (Exadata) Materialize table & Create Index (no for Exadata)
CREATE TABLE AHN_FLAT
TABLESPACE USERS
PCTFREE 0
NOLOGGING
PARALLEL 16 AS
SELECT
VAL_D1,
VAL_D2,
VAL_D3
FROM
INPTAB_EXT;
CREATE INDEX AHN_FLAT_IDX
ON AHN_FLAT (
VAL_D1,
VAL_D2)
TABLESPACE INDX
PCTFREE 0
NOLOGGING
PARALLEL 16;
Loading
Tuning
Tune DB server parameters (working memory, )
Use different file-system for DB and input data (faster IO)
Loading
Medium benchmark comparison
PostgreSQL flat: Binary loader, not native parallel
16 by script, index not parallel
Oracle flat: SQL loader from LAS (ext. table, preprocessor script) , parallel 16
MonetDB flat: Binary loader, parallel
Loading
Medium benchmark comparison: Loading (inc. indexing) and storage of 23090M points
Loading [s]
Oracle blocks global
70000,00
Oracle blocks global compress
192612,07
Oracle blocks increm.
14000,00
Oracle blocks increm. compress
45000,00
PostgreSQL blocks increm. *
7000,00
PostgreSQL blocks increm. compress*
9079,57
Oracle flat
15825,53
PostgreSQL flat
95014,05
MonetDB
8490,90
LAStools**
1639,30
LAStools LAZ**
2377,30
Oracle Exadata (oe-qh)
928,84
Loading
Storage Storage
[Mpts/s]
[GB] [Mpts/GB]
0,33 700,00
32,99
0,12 220,10
104,91
1,65 700,00
32,99
0,51 220,10
104,91
3,30 200,00
115,45
2,54 106,80
216,20
1,46 997,10
23,16
0,24 1780,90
12,97
2,72 529,40
43,62
14,09 440,50
52,42
9,71
35,67
647,28
22,71
94,24
223,80
* Ordered loading
** Licensed version
Copyright 2014 Oracle and/or its affiliates. All rights reserved. |
Loading
Medium benchmark comparison: Loading (inc. indexing) of 23090M points
Loading [Mpts/s]
25,00
22,71
20,00
15,00
14,09
9,71
10,00
5,00
3,30
0,33
0,12
Oracle blocks
global
Oracle blocks
global compress
2,72
2,54
1,65
1,46
0,51
0,24
0,00
Oracle blocks
increm.
Oracle flat
PostgreSQL flat
MonetDB
LAStools
LAStools LAZ
Oracle Exadata
Loading
Medium benchmark comparison: Loading (inc. indexing) of 23090M points
Loading [Mpts/s]
4,00
3,50
3,30
3,00
2,72
2,54
2,50
2,00
1,65
1,46
1,50
1,00
0,51
0,50
0,33
0,24
0,12
0,00
Oracle blocks
global
Oracle blocks
global compress
Oracle blocks
increm.
Oracle blocks
PostgreSQL blocks PostgreSQL blocks
increm. compress
increm.
increm. compress
Oracle flat
PostgreSQL flat
MonetDB
LAStools
LAStools LAZ
Oracle Exadata
Loading
Medium benchmark comparison: Storage of 23090M points
Storage [Mpts/GB]
700,00
647,28
600,00
500,00
400,00
300,00
223,80
216,20
200,00
104,91
104,91
115,45
100,00
32,99
32,99
23,16
12,97
Oracle flat
PostgreSQL flat
43,62
52,42
MonetDB
LAStools
0,00
Oracle blocks
global
Oracle blocks
global compress
Oracle blocks
increm.
LAStools LAZ
Oracle Exadata
Program Agenda
1
Introduction
Loading
Querying
Conclusions
Copyright 2014 Oracle and/or its affiliates. All rights reserved. |
Querying
Oracle blocks CLIP_PC (return blocks)
SQL> select
blk_id,
num_points
from
table(
sdo_pc_pkg.clip_pc(
inp
=> (select pc from pcs where id = 1),
ind_dim_qry
=> sdo_geometry(
2003,
null,
null,
sdo_elem_info_array(1, 1003, 3),
sdo_ordinate_array(10, 10, 14, 14)),
other_dim_qry => null,
qry_min_res
=> 1,
qry_max_res
=> 1));
BLK_ID NUM_POINTS
---------- ---------53
25
Querying
Oracle blocks CLIP_PC (return individual point records)
select
query_points.x,
query_points.y,
query_points.z
from
table(
sdo_pc_pkg.clip_pc(
inp
=> (select pc from pcs where id = 1),
ind_dim_qry
=> sdo_geometry(
2003, null, null,
sdo_elem_info_array(1, 1003, 3),
sdo_ordinate_array(10, 10, 14, 14)),
other_dim_qry => null,
qry_min_res
=> 1,
qry_max_res
=> 1)) query_blocks,
table(
sdo_util.getvertices(
geometry => sdo_pc_pkg.to_geometry(
pts
=> query_blocks.points,
num_pts
=> query_blocks.num_points,
pc_tot_dim => 3,
srid
=> null))) query_points;
Copyright 2014 Oracle and/or its affiliates. All rights reserved. |
Querying
Oracle blocks CLIP_PC (query by non-indexed dim)
select
query_points.x,
query_points.y,
query_points.z,
query_points.w Intensity -- followed by v5 - v11
from
table(
sdo_pc_pkg.clip_pc(
inp
=> (select pc from pcs where id = 1),
ind_dim_qry
=> sdo_geometry(
2003, null, null,
sdo_elem_info_array(1, 1003, 3),
sdo_ordinate_array(10, 10, 14, 14)),
other_dim_qry => sdo_mbr(
lower_left => sdo_vpoint_type(123,
1),
upper_right => sdo_vpoint_type(123, 1000)),
qry_min_res
=> 1,
qry_max_res
=> 1)) query_blocks,
table(
sdo_util.getvertices(
geometry => sdo_pc_pkg.to_geometry(
pts
=> query_blocks.points,
num_pts
=> query_blocks.num_points,
pc_tot_dim => 4,
srid
=> null))) query_points;
X
Y
Z INTENSITY
---------- ---------- ---------- ---------10
13
123
456
Querying
Oracle blocks CLIP_PC (support non-blocked dimensions)
select
query_points.x,
query_points.y,
query_points.z,
query_points.w Intensity, -- followed by v5 - v11
out.non_blocked_dim
from
table(
sdo_pc_pkg.clip_pc(
inp
=> (select pc from pcs where id = 1),
ind_dim_qry
=> sdo_geometry(2003, null, null, sdo_elem_info_array(1, 1003, 3), sdo_ordinate_array(10, 10, 14, 14)),
other_dim_qry => sdo_mbr(
lower_left => sdo_vpoint_type(123,
1),
upper_right => sdo_vpoint_type(123, 1000)),
qry_min_res
=> 1,
qry_max_res
=> 1)) query_blocks,
table(
sdo_util.getvertices(
geometry => sdo_pc_pkg.to_geometry(
pts
=> query_blocks.points,
num_pts
=> query_blocks.num_points,
pc_tot_dim => 4,
srid
=> null ,
get_ids
=> 1))) query_points ,
pcs_out out
where
out.ptn_id
= query_points.v5 and
-- v5 is blk_id, v6 is pt_id
out.point_id = query_points.v6;
X
Y
Z INTENSITY NON_BLOCKED_DIM
---------- ---------- ---------- ---------- -------------------------------11
10
123
456 # 21
Querying
Oracle blocks SDO_PC_NN
SQL> select
2
rownum pt_pos,
3
sdo_geometry(
4
3001,
5
null,
6
sdo_point_type(x, y, z),
10
null,
11
null) pts
12 from
13
table(
14
sdo_util.getvertices(
15
geometry => sdo_pc_pkg.to_geometry(
16
pts => sdo_pc_pkg.sdo_pc_nn(
17
pc
=> (select pc from pcs where pc_id = 1),
18
center => sdo_geometry(3001, null, sdo_point_type(15, 15, 30), null, null),
24
n
=> 3200),
25
num_pts
=> 3200,
26
pc_tot_dim => 3,
27
srid
=> null,
28
blk_domain => null,
29
get_ids
=> 1)));
PT_POS
PTS(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
-----------------------------------------------------------------------------------------1
SDO_GEOMETRY(3001, NULL, SDO_POINT_TYPE(15, 15, 30), NULL, NULL)
2
SDO_GEOMETRY(3001, NULL, SDO_POINT_TYPE(15, 14, 29), NULL, NULL)
3200
SDO_GEOMETRY(3001, NULL, SDO_POINT_TYPE(43, 44, 87), NULL, NULL)
Querying
PostgreSQL blocks PC_Intersects / PC_Intersection (return blocks)
SELECT
PC_Intersection(pa,geom)
FROM patches,
query_polygons
Querying
PostgreSQL blocks PC_Intersects / PC_Intersection (return individual point records)
SELECT
PC_Get(qpoint, 'x') AS x,PC_Get(qpoint, 'y') AS y,
PC_Get(qpoint, 'z') AS z
FROM
(
SELECT
PC_Explode(PC_Intersection(pa,geom)) AS qpoint
FROM patches, query_polygons
WHERE PC_Intersects(pa,geom) and query_polygons.id = 1
) AS qtable;
Querying
PostgreSQL blocks Nearest Neighbor
SELECT
PC_Get(qpoint, 'x') as x, PC_Get(qpoint, 'y') as y, PC_Get(qpoint, 'z') as z
FROM
(SELECT
PC_explode(pa) as qpoint
FROM
(SELECT
pa
FROM patches ORDER BY geometry(pa) <#> ST_SetSRID(ST_MakePoint(px, py), SRID)
LIMIT 9
) as A
) as B
ORDER BY ((PC_Get(qpoint, 'x') - px)^2 +(PC_Get(qpoint, 'y') - py)^2)
LIMIT 1000;
Querying LAStools
Querying
LAStools lasmerge
If hybrid approach with PostgreSQL-PostGIS:
CREATE TABLE query_polygons (id integer, geom public.geometry(Geometry, SRID));
INSERT INTO query_polygons VALUES (1,ST_GeomFromEWKT(WKT));
psql dbname -U dbuser -h dbhost -p dbport -t -A -c \
SELECT l.filepath FROM lasindex l,query_polygons qp WHERE ST_Intersects(qp.geom, l.geom) AND qp.id=1"
\
> input1.list
Rectangle:
lasmerge -lof input.list
Circle:
lasmerge -lof input.list
-inside_circle cx cy r -o output.las
Querying
LAStools lasclip (query region in ShapeFile)
pgsql2shp -f query5.shp -h dbhost -p dbport -u dbuser -P dbpass dbname \
select ST_SetSRID(geom, 28992) from query_polygons where id = 5;
Querying
LAStools
Tune LAZ chunksize (default 50000) depending on your type of queries
lassort of large files done with sub-tiling
Querying
Oracle flat Plain old SQL
Rectangle:
SELECT
*
FROM
FLAT
WHERE
(VAL_D1 BETWEEN minx AND maxx) AND
(VAL_D2 BETWEEN miny AND maxy);
Circle:
SELECT
*
FROM
(
SELECT
*
FROM
FLAT
WHERE
(VAL_D1 BETWEEN cx - r AND cx + r) AND
(VAL_D2 BETWEEN cy - r AND cy + r)
) B
WHERE
POWER((VAL_D1 - cx), 2) +
POWER((VAL_D2 - cy), 2) <= POWER(r, 2);
Querying
Oracle flat SDO_PointInPolygon
Other regions (example circle):
SQL> SELECT
x,y,z
FROM
TABLE(
mdsys.sdo_PointInPolygon(
CURSOR(
select
val_d1 x,
val_d2 y,
val_d3 z
from
flat),
MDSYS.SDO_GEOMETRY(2003, NULL, NULL,
MDSYS.SDO_ELEM_INFO_ARRAY(1, 1003, 4), -- circle with
MBR(10,10, 14,14)
MDSYS.SDO_ORDINATE_ARRAY(10, 12, 12, 10, 14, 12)),
0.05));
X
Y
Z
---------- ---------- ---------10
12
123
13 rows selected.
Elapsed: 00:00:13.16
SQL> SELECT
x, y, z
FROM
TABLE(
mdsys.sdo_PointInPolygon(
CURSOR(
select
val_d1 x,
val_d2 y,
val_d3 z
from
flat
where
val_d1 between 10 and 14 and
val_d2 between 10 and 14),
MDSYS.SDO_GEOMETRY(2003, NULL, NULL,
MDSYS.SDO_ELEM_INFO_ARRAY(1, 1003, 4), -- circle with MBR
(10, 10, 14, 14)
MDSYS.SDO_ORDINATE_ARRAY(10, 12, 12, 10, 14, 12)), 0.05));
X
Y
Z
---------- ---------- ---------10
12
123
13 rows selected.
Elapsed: 00:00:00.00
Copyright 2014 Oracle and/or its affiliates. All rights reserved. |
Querying
Oracle flat
Nearest neighbor - Approximation:
SELECT
*
FROM
(
SELECT
*
FROM
flat
WHERE
(
(x BETWEEN (px r) AND (px + r)) AND
(y BETWEEN (py r) AND (py + r))
)
ORDER BY
POWER(x - px, 2) + POWER(y - py, 2)
) a
WHERE
ROWNUM <= 1000;
Querying
Medium benchmark comparison
PostgreSQL flat: parallel
querying with PQGR algorithm
Oracle flat: native parallel
Querying
Medium benchmark comparison: 20M and 23090M; Queries #1 and #6
* Parallelized with
algorithmn (not native)
** Single process
Querying
Medium benchmark comparison: Queries #1
Query 1 20M
Query 1 23090M
0,45
0,40
0,35
Time [s]
0,30
0,25
0,20
0,15
0,10
0,05
0,00
Oracle blocks
global
Oracle blocks
global compress
Oracle blocks
Oracle blocks
PostgreSQL
increm.
increm. compress blocks increm.
PostgreSQL
blocks increm.
compress
Oracle flat
PostgreSQL flat
MonetDB
LAStools
LAStools LAZ
Oracle Exadata
Querying
Query 6 20M
1,60
Query 6 23090M
1,40
Time [s]
1,20
1,00
0,80
0,60
0,40
0,20
0,00
Oracle blocks
global
Oracle blocks
global compress
Oracle blocks
increm.
Oracle blocks
increm.
compress
PostgreSQL
blocks increm.
PostgreSQL
blocks increm.
compress
Oracle flat
PostgreSQL flat
MonetDB
LAStools
LAStools LAZ
Oracle Exadata
Program Agenda
1
Introduction
Loading
Querying
Conclusions
Copyright 2014 Oracle and/or its affiliates. All rights reserved. |
8
27166
1
pc_tol
pc_tot_dimensions
pc_domain
pc_val_attr_tables
pc_other_attrs
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
'PCS',
--(base table)
'PC',
--(base column)
'BLOCKS',
--(data table)
'blk_capacity=10000',
--(block capacity, tablespace)
mdsys.sdo_geometry(
--(spatial extent)
2003,
null,
null,
mdsys.sdo_elem_info_array(1, 1003, 3),
mdsys.sdo_ordinate_array(1, 1, power(2, 13), power(2, 13))),
0.5,
--(tolerance)
3,
--(total dimensions)
null,
null,
xmltype(
--(object metadata pyramiding)
'<opc:sdoPcObjectMetadata
xmlns:opc="http://xmlns.oracle.com/spatial/vis3d/2011/sdovis3d.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<opc:sdoPcPyramid preserveLevel1="true"/>
</opc:sdoPcObjectMetadata>'));
sdo_pc_pkg.create_pc(
pc,
'INPTAB');
--(input table)
8 rows selected.
6
5
4
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
1 2 1 3 1
Query with LoD
select
query_points.x,
query_points.y,
query_points.z
from
table(
sdo_pc_pkg.clip_pc(
inp
=> (select pc from pcs where id = 1),
ind_dim_qry
=> sdo_geometry(
2003,
null,
null,
sdo_elem_info_array(1, 1003, 3),
sdo_ordinate_array(10, 10, 14, 14)),
other_dim_qry => null,
qry_min_res
=> 1,
qry_max_res
=> 1)) query_blocks,
table(
sdo_util.getvertices(
geometry => sdo_pc_pkg.to_geometry(
pts
=> query_blocks.points,
num_pts
=> query_blocks.num_points,
pc_tot_dim => 3,
srid
=> null))) query_points;
Copyright 2014 Oracle and/or its affiliates. All rights reserved. |
SELECT BLK_ID
SELECT x, y, z
FROM table (
sdo_PointInPolygon (
cursor (
INSERT INTO
WITH A AS (
SELECT geom, st_xmin(geom) as minx, st_xmax(geom) as maxx,
query_results_1 ( x,y,z )
SELECT PC_Get(qpoint, x) as x,
PC_Get(qpoint, y) as y,
PC_Get(qpoint, z) as z
FROM
(SELECT PC_explode(pc_intersection(pa,geom)) as qpoint
FROM patches, query_grid_1
A,
http://trac.osgeo.org/postgis/wiki/UsersWikiCreateFishnet
Copyright 2014 Oracle and/or its affiliates. All rights reserved. |
Time[s]
PostgreSQL flat
5
Oracle flat
MonetDB flat
PostgreSQL blocks
Oracle blocks
2
LAStools
1
0
20M
210M
2201M
23090M
What if we want DBMS with speed of flat tables but good scaling? (we do not care about storage)
Flat table
15
2
1
0
0
0
x y
0 0
1 0
0 1
0 2
1 1
....
B-Tree XY
index
x
0
0
0
0
1
1
y
0
1
2
3
0
1
pos
0
2
3
9
1
4
Flat table
x
3
15
2
1
0
0
0
x y
0 0
1 0
0 1
0 2
1 1
....
B-Tree XY
x
0
0
0
0
1
1
y
0
1
2
3
0
1
pos
0
2
3
9
1
4
Flat table
x
3
15
clustering
1
0
0
0
x
0
0
0
0
1
1
y
0
1
2
3
0
1
pos
0
1
2
3
4
5
x
3
15
x
3
2
1
0
Morton / Peano
Hilbert
0
1
15
15
0
0
row
7
63
5
row
3
2
row
01
00
15
3
0
00
01
1
0
4
3
2
1
0
0
col
0
0
col
2x2x2
4x4x4
8x8x8
Also in 3D
row
3
2
row
01
00
0
00
01
15
3
0
0
col
63
2x2x2
4x4x4
8x8x8
Peano (3 ranges)
63
N*N
GRID
HILBERT
PEANO
2*2
1.11
1.22
0.11
4*4
1.64
2.16
0.52
8*8
2.93
4.41
1.48
16*16
5.60
9.29
3.69
Hilbert (2 ranges)
PostgreSQL
CREATE TABLE flat (x,y,z,morton);
[ BINARY LOAD ]
CREATE INDEX morton_index ON flat (morton);
CLUSTER flat using morton_index;
MonetDB
CREATE TABLE flat_temp (x,y,z,morton);
[ BINARY LOAD ]
CREATE TABLE flat (x,y,z,morton);
INSERT INTO flat SELECT * FROM flat_temp ORDER BY morton;
DROP TABLE flat_temp;
111
7
110
6
101
5
100
4
011
3
010
2
001
1
000
000
0
0
61
63
62
6
3
010
2
011
3
001
1
100 101
4
5
110
6
111
7
X
Copyright 2014 Oracle and/or its affiliates. All rights reserved. |
111
7
110
6
101
5
100
4
011
3
010
2
001
1
000
0
12
300
000
0
001
1
010
2
011
3
100 101
4
5
110
6
111
7
Quadcode 0:
Morton range 0-15
Quadcode 10:
Morton range 16-19
Quadcode 12:
Morton range 24-27
Quadcode 300:
Morton range 48-48
(Morton code gaps resp. 0, 4, 20)
query_geometry, polygon
Note : SW=0, NW=1, SE=2, NE=3
Time[s]
5
4
PostgreSQL
PostgreSQL Morton
2
1
0
20M
210M
2201M
23090M
Time[s]
5
4
MonetDB
MonetDB Morton
2
1
0
20M
210M
2201M
23090M
Total load
time [hours]
Total
size [TB]
#points
LAStools unlic.
22:54
12.181
638,609,393,087
LAStools lic
16:47
11.617
638,609,393,101
15:48
0.973
638,609,393,101
Oracle Exadata
4:39
2.240
639,478,217,460
MonetDB*
17:21
15.00
639,478,217,460
Time[s]
LAStools unlic. LAStools Exadata MonetDB LAStools unlic. LAS DB LAStools unlic. LAS No DB
LAStools LAS DB LAStools LAS No DB LAStools LAZ DB LAStools LAZ No DB Exadata MonetDB
74861
74863
74863
74855
0,07
0,79
0,06
0,77
0,2
0,84
0,48
108,99
718057
718070
718070
718132
0,16
0,85
0,16
0,78
0,49
1,09
0,79
111,33
34700
34699
34675
34699
0,07
0,78
0,06
0,7
0,27
0,89
1,22
109,36
563119
563105
563082
563105
0,16
0,85
0,12
0,78
0,44
1,15
1,69
112,9
2413
1734
2434
2434
0,08
0,82
0,08
0,69
0,43
1,02
0,4
112,43
591
591
591
591
0,05
0,84
0,05
0,72
0,13
0,73
0,44
111,31
343168
343168
343171
343171
0,26
1
0,26
0,98
1,32
1,95
0,6
114,98
0
0
0
0
0,04
0,75
0,04
0,66
0,03
0,69
0
113,51
1000
112,9
5000
107,94
0
109,2
182871
182875
182875
182875
0,7
31,05
0,39
28,2
0,63
29,46
1,43
110,42
460140
460158
387201
387193
1,52
32
1,57
30,2
1,97
30,31
1,29
112,17
45831
45813
45815
45815
0,55
31,43
0,55
28,76
0,99
29,23
1,71
112,14
2365925 2365896 2273469 2273380
3,72
34,72
3,87
33,88
5,67
35,88
2,86
120,93
620568
620527
620719
620529
2,34
33,44
2,27
32,4
3,94
33,43
1,58
118,71
3992330 3992377 3992290 3992525
0,49
1,37
0,57
1,23
1,94
2,63
2,23
120,18
2203066 2203055 2201280 2203055
0,32
1,16
0,32
1,01
1,1
1,71
2,51
114,31
382395
382335
382335
386278
2,23
4,43
2,38
4,11
16,94
18,81
0,95
109,2
27443
27453
27459
27456
1,61
914,44
0,25
29,18
0,35
29,06
1,23
107,92
897042
896927
897359
897126
412,29
804,29
266,13
958,88
317,91
1039,09
23,34
723,58
765989
766039
766029
766029
102,19
419,78
104,09
428,51
151,45
600,93
15,05
559,73
12148049 12147863 121478022246.9
154,97
1115,2
141,95
1800,41
284,58
2478,47
113,37
2246,9
691422551 6,91E+08 6,91E+08151.16
379,2
886,35
318,93
1051,76
552,01
1154,7
330,85
151,16
2468239 2468268 2468367 2468367
251,13
4106,54
294,99
13454
551,13
16510,9
393,21 6308,53
2,03E+09 3,53E+1412228.76
1193,1 12228,76
2124162497 2,12E+09 2,12E+09622.73
417,28
1127,56
214,98
405,26
536,1
560,95
25,79
622,73
809097723 8,09E+08 8,67E+081469.47
1635,3
1883,19
2240,1
2525,98
2426,43
2718,26
67,67 1469,47
1509662615 1,51E+09 1,51E+095577.69
3579,73
5746,61
4809,9
6419,05
3855,93
6396,54
120,02 5577,69
2,9E+09 1,34E+1427683.62
3569,54 27683,62
Time [s]
0,6
LAStools LAS No DB
0,5
LAStools LAZ DB
LAStools LAZ No DB
0,4
Exadata
0,3
MonetDB
0,2
0,1
0
Time [s]
LAStools LAS No DB
2,5
LAStools LAZ DB
LAStools LAZ No DB
Exadata
1,5
MonetDB
1
0,5
0
Time [s]
2500
LAStools LAS DB
LAStools LAS No DB
2000
LAStools LAZ DB
LAStools LAZ No DB
1500
Exadata
1000
MonetDB
500
0
Program Agenda
1
Introduction
Loading
Querying
Conclusions
Copyright 2014 Oracle and/or its affiliates. All rights reserved. |
Conclusions
For simple queries LAStools is the fastest but has not DBMS functionalities.
Careful with multi-user environments
LAStools with LAZ offers best storage (but slower queries)
For complex queries DBs with blocks offer good performance
For small datasets (million points) flat tables are suitable
For Exadata, a lot more
SFC-based flat tables improve scaling issue and faster queries (being investigated)
Oracle, MonetDB and LAStools actively improving PointCloud support
Copyright 2014 Oracle and/or its affiliates. All rights reserved. |