0

I have a large osm dataset. When I execute a pgr_ksp query, it takes +30 minutes

Example:

SELECT seq , id1 , id2 , cost
 FROM pgr_ksp(
   'SELECT id, source, target, cost FROM myways',
   524356, 1210854, 2, false);

My virtual server has 4 processors and 3GB RAM. My ways table has 2290470 rows.

The other functions work normally but pgr_ksp does not.

Does anyone know what is the problem?

2

If you have a large network, then selecting the whole network in your query will always become slow whatever routing algorithm you use.

Have you tried to only select the network you actually need and not the whole 2 Mio. rows? The easiest way is to limit the selected area using a BBOX, see for example Why is any pgr_* routing function taking forever based on OSM data in an pgrouting enabled DB

Because KSP is more complex than Dijstra fro example it's likely to be slower, and if you try it with a large network such as yours the difference may become more obvious.

| improve this answer | |
  • I cannot get the answer when I am using ksp algorithm when the 4th argument of ksp set to true but when I set it as false it works. But in the same case it was worked with other data when "directed :=true". may I know this variation. – Karthik Jun 26 '19 at 10:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.