Skip to content

useless where clause on osm_type slows down the requests #1

@etienneJr

Description

@etienneJr

Hi!
When a make a request with a filter by tag like way[leisure=playground], the parser writes this :

WITH _ab09a6067869338c0051f44462ec1eb829a19506 AS (
  SELECT * FROM way WHERE
    osm_type = 'w' AND
    (tags?'leisure' AND tags->>'leisure' = 'playground')
)

and for nwr[leisure=playground] :

WITH _bd1c8670f2520febe2cfb475addef794b2090256 AS (
  SELECT * FROM nwr WHERE
    osm_type = ANY (ARRAY['n', 'w', 'r']) AND
    (tags?'leisure' AND tags->>'leisure' = 'playground')
)

The where clause to filter on osm_type seems useless to me since it is redundant with the table on which the request is made.

Issue : it greatly increases the execution time since the osm_type column is created in the VIEW (at least for postgres backend) so it is not indexed.
[edit ] I myself have a problem reproducing this issue ... the requests have become faster once again, I don't understand why.

I imagine this clause is present here since it is usefull for other more complex requests ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions