1 year ago

#288199

test-img

BenjaminW

postgis/postgresql Using GIST to create a multicolumn-index on types geometry(point, 4326) and bigint succeeds, but the query cannot hit all

create extension btree_gist
CREATE INDEX poi_timestamp_midx ON spatio using gist(poi, timestamp);

explain analyze
select count(*) from spatio as a
where ST_DWithin(ST_GeomFromText('Point(30.391324 114.117508)',4326),a.poi,0.01)
and timestamp > 1645727066-2*86400
and timestamp < 1645727066+86400
  ;
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Aggregate  (cost=250.00..250.02 rows=1 width=8) (actual time=13.561..13.563 rows=1 loops=1)                                                                                                                |
  ->  Custom Scan (Citus Adaptive)  (cost=0.00..0.00 rows=100000 width=8) (actual time=13.541..13.545 rows=32 loops=1)                                                                                     |
        Task Count: 32                                                                                                                                                                                     |
        Tuple data received from nodes: 32 bytes                                                                                                                                                           |
        Tasks Shown: One of 32                                                                                                                                                                             |
        ->  Task                                                                                                                                                                                           |
              Tuple data received from node: 1 bytes                                                                                                                                                       |
              Node: host=10.174.250.40 port=5432 dbname=postgres                                                                                                                                           |
              ->  Aggregate  (cost=33.30..33.31 rows=1 width=8) (actual time=0.087..0.087 rows=1 loops=1)                                                                                                  |
                    ->  Index Scan using poi_timestamp_midx_102039 on spatio_102039 a  (cost=0.27..33.30 rows=1 width=0) (actual time=0.086..0.086 rows=0 loops=1)                                         |
                          Index Cond: (poi && st_expand('0101000020E6100000D12346CF2D643E402D41464085875C40'::geometry, '0.01'::double precision))                                                         |
                          Filter: (("timestamp" > 1645554266) AND ("timestamp" < 1645813466) AND st_dwithin('0101000020E6100000D12346CF2D643E402D41464085875C40'::geometry, poi, '0.01'::double precision))|
                  Planning Time: 0.133 ms                                                                                                                                                                  |
                  Execution Time: 0.102 ms                                                                                                                                                                 |
Planning Time: 1.730 ms                                                                                                                                                                                    |
Execution Time: 13.630 ms                                                                                                                                                                                  |`

postgresql

geometry

postgis

gist

0 Answers

Your Answer

Accepted video resources