Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pgr_extractVertices to Proposed #2087

Closed
TimMcCauley opened this issue Aug 21, 2021 · 3 comments
Closed

pgr_extractVertices to Proposed #2087

TimMcCauley opened this issue Aug 21, 2021 · 3 comments

Comments

@TimMcCauley
Copy link

TimMcCauley commented Aug 21, 2021

Lately I have been using the createTopology quite heavily and noticed that you have implemented a newer approach using extractVertices to create the topology. The differences in performance are phenomenal which I wanted to share here.

Using PostGIS v.3.2.1 my input is a table consisting of approx 60k linestrings.

gis=# \d public.ls_test
          Table "public.ls_test"
 Column |       Type       | Collation | Nullable | Default
--------+------------------+-----------+----------+---------
 id     | integer          |           |          |
 geom   | geometry         |           |          |
 gid    | integer          |           |          |
 source | integer          |           |          |
 target | integer          |           |          |
 x1     | double precision |           |          |
 y1     | double precision |           |          |
 x2     | double precision |           |          |
 y2     | double precision |           |          |
Indexes:
    "ls_test_geom_idx" gist (geom)
    "ls_test_source_idx" btree (source)
    "ls_test_target_idx" btree (target)
    "gid_idx" btree (gid)

createTopology

NOTICE:  -------------> TOPOLOGY CREATED FOR  62426 edges
NOTICE:  Rows with NULL geometry or NULL id: 0
NOTICE:  Vertices table for table public.depth_intersections_test is: public.depth_intersections_test_vertices_pgr
NOTICE:  ----------------------------------------------
 pgr_createtopology
--------------------
 OK
(1 row)

Time: 68428.509 ms (01:08.429)

extractVertices (as described here)

UPDATE 62426
Time: 1849.968 ms (00:01.850)

I have validated the results which are correct; I am not sure how much impact the tolerance factor has in the createTopology function, for my use case it actually isn't required as I already know that the vertices lie on top of each other that should be treated as a vertex - @cvvergara @dkastl I recommend highlighting this approach for the next major version :-)

@cvvergara
Copy link
Member

@TimMcCauley
Thanks for testing on a large data set.
1 hour vs 1 minute its quite a difference.
Right now its experimental, and can be moved up to proposed on version 3.3
and moved to official on version 4.0.

@cvvergara cvvergara added this to the Release 3.3.0 milestone Aug 21, 2021
@TimMcCauley
Copy link
Author

@cvvergara it is 1 minute vs 1 second, even better (for both approaches :))

@cvvergara
Copy link
Member

I need glasses :-)

@cvvergara cvvergara changed the title createTopology vs. extractVertices pgr_extractVertices to Proposed Oct 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants