databendlabs / databend

๐——๐—ฎ๐˜๐—ฎ, ๐—”๐—ป๐—ฎ๐—น๐˜†๐˜๐—ถ๐—ฐ๐˜€ & ๐—”๐—œ. Modern alternative to Snowflake. Cost-effective and simple for massive-scale analytics. https://databend.com
https://docs.databend.com
Other
7.87k stars 751 forks source link

refactor(query): refactor geometry functions #16870

Closed b41sh closed 2 days ago

b41sh commented 3 days ago

I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/

Summary

refactor geometry functions to improve performance

for example:

The execution time for calculating 500,000 rows geometry st_distance has been reduced from 9.097 secs to 5.951 secs

CREATE OR REPLACE TABLE test AS
SELECT
    number AS id,
    'SRID=4326;POINT(100 200)' as geom,
    'SRID=4326;POINT(300 200)' as geom2
FROM numbers(500000);

old
select st_distance(to_geometry(geom), to_geometry(geom2)) from test;
500000 rows read in 9.097 sec. Processed 500 thousand rows, 38.15 MiB (54.96 thousand rows/s, 4.19 MiB/s)

new
select st_distance(to_geometry(geom), to_geometry(geom2)) from test;
500000 rows read in 5.951 sec. Processed 500 thousand rows, 38.15 MiB (84.01 thousand rows/s, 6.41 MiB/s)

fixes: #[Link the issue here]

Tests

Type of change


This change isโ€‚Reviewable