Skip to content

Commit

Permalink
add station to station limiter limiter, significantly improves perfor…
Browse files Browse the repository at this point in the history
…mance (#183)
  • Loading branch information
Daniel-J-Mason authored May 25, 2024
1 parent 54669cd commit 3d82b21
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ sell_market AS (SELECT commodity_id,
st_3ddistance(buy_market.coordinates_geom, sell_market.coordinates_geom) AS route_distance
FROM buy_market
INNER JOIN sell_market ON buy_market.commodity_id = sell_market.commodity_id
AND st_3ddwithin(sell_market.coordinates_geom, buy_market.coordinates_geom, #{maxRouteDistance})
AND buy_market.buy_station_id != sell_market.sell_station_id
AND 100 >= buy_market.rn
WHERE (sell_market.sell_price - buy_market.buy_price) > 0
Expand Down Expand Up @@ -200,6 +201,7 @@ sell_market AS (SELECT commodity_id,
st_3ddistance(buy_market.coordinates_geom, sell_market.coordinates_geom) AS route_distance
FROM buy_market
INNER JOIN sell_market ON buy_market.commodity_id = sell_market.commodity_id
AND st_3ddwithin(sell_market.coordinates_geom, buy_market.coordinates_geom, #{maxRouteDistance})
AND buy_market.buy_station_id != sell_market.sell_station_id
AND 100 >= buy_market.rn
WHERE (sell_market.sell_price - buy_market.buy_price) > 0
Expand Down Expand Up @@ -291,6 +293,7 @@ sell_market AS (SELECT commodity_id,
st_3ddistance(buy_market.coordinates_geom, sell_market.coordinates_geom) AS route_distance
FROM buy_market
INNER JOIN sell_market ON buy_market.commodity_id = sell_market.commodity_id
AND st_3ddwithin(sell_market.coordinates_geom, buy_market.coordinates_geom, #{maxRouteDistance}
AND buy_market.buy_station_id != sell_market.sell_station_id
AND 100 >= sell_market.rn
WHERE (sell_market.sell_price - buy_market.buy_price) > 0
Expand Down Expand Up @@ -383,6 +386,7 @@ sell_market AS (SELECT commodity_id,
st_3ddistance(buy_market.coordinates_geom, sell_market.coordinates_geom) AS route_distance
FROM buy_market
INNER JOIN sell_market ON buy_market.commodity_id = sell_market.commodity_id
AND st_3ddwithin(sell_market.coordinates_geom, buy_market.coordinates_geom, #{maxRouteDistance})
AND buy_market.buy_station_id != sell_market.sell_station_id
AND 100 >= sell_market.rn
WHERE (sell_market.sell_price - buy_market.buy_price) > 0
Expand Down

0 comments on commit 3d82b21

Please sign in to comment.