My goal is to find the distance and shortest path between 1000+ Origin-Destination pairs in a road network. I have a table with the pair ID, the origin vertex ID and the destination vertex ID for each pair. Everything works fine when I use the pgr_dijkstra, where I get a path and a agg_cost for the following example:
SELECT * FROM pgr_dijkstra( 'SELECT gid as id, source, target, length as cost FROM route1', 48302, 44382, FALSE);
What I would like to do is replace the origin and destination vertices (48302, 44382) by the Origin and Destination vertex id columns from my table, matched by the pair ID. In other words, I'd like to get the distance and path for all my OD pairs in a single query.