Skip to content
This repository was archived by the owner on Jan 5, 2026. It is now read-only.
This repository was archived by the owner on Jan 5, 2026. It is now read-only.

Querying multifield function using .* makes multiple requests to the provider #482

@ethervoid

Description

@ethervoid

While I was working with routing I notice that for every routing we did it was translated to 3 requests to the provider (in this case MapBox)

So I started investigating if we have some problem collecting metrics or if we were indeed doing 3 requests to the routing provider.

I checked for one Kibana and I did an isolated request confirming we were doing 3 requests

screenshot from 2018-03-14 17-50-07

I went to the staging server and started sniffing traffic to the provider API in order to confirm we were doing 3 requests and yes we are. Here are the three syncs:

16:37:07.534849 IP dbd-services-1-st.36786 > server-54-230-130-184.ams50.r.cloudfront.net.https: Flags [S], seq 3724214428, win 29200, options [mss 1460,sackOK,TS val 2071754913 ecr 0,nop,wscale 7], length 0
16:37:07.667390 IP dbd-services-1-st.36796 > server-54-230-130-184.ams50.r.cloudfront.net.https: Flags [S], seq 296619264, win 29200, options [mss 1460,sackOK,TS val 2071755046 ecr 0,nop,wscale 7], length 0
16:37:07.773261 IP dbd-services-1-st.36806 > server-54-230-130-184.ams50.r.cloudfront.net.https: Flags [S], seq 2118231246, win 29200, options [mss 1460,sackOK,TS val 2071755152 ecr 0,nop,wscale 7], length 0

And that is cause by the unnest we can do for the returned record of the function. Let me explain. If we do:

SELECT duration, length, shape FROM cdb_route_point_to_point('POINT(-3.70237112 40.41706163)'::geometry,'POINT(-3.69909883 40.41236875)'::geometry, 'car')

everything is fine, we make a single request but if we do:

SELECT (cdb_route_point_to_point('POINT(-3.70237112 40.41706163)'::geometry,'POINT(-3.69909883 40.41236875)'::geometry, 'car')).*

we do 3 requests, my guess is one per field.

My main suspect is pl/proxy and how it works with this kind of special unnesting but I need to dig deeper

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