Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Disclaimer: the author of the question is a novice in PostgreSQL and pgRouting.

As I understand doing a shortest path query in pgRouting is a complicated SELECT underneath.

And as I know unlike any UPDATE queries, SELECT queries in PostgreSQL can be done simultaneously, because they don't interfere with the the database integrity anyhow.

If the above is correct, the question is:

Can I query pgRouting for shortest paths, for example, each 1 millisecond and get the same timing results as in case with truly sequential shortest path queries? Is case 2 possible?

Usual case (1):

  • [Time elapsed: 0 seconds]
  • Query for shortest path A
  • Get result for the shortest path A
  • [Time elapsed: 1.5 seconds]
  • Query for shortest path B
  • Get result for the shortest path B
  • [Time elapsed: 3 seconds]

A case with simultaneous queries (2):

  • [Time elapsed: 0 seconds]
  • Query for shortest path A
  • [Time elapsed: 0.001 seconds]
  • Query for shortest path B
  • Get result for the shortest path A
  • [Time elapsed: 1.5 seconds]
  • Get result for the shortest path B
  • [Time elapsed: 1.5001 seconds]
share|improve this question
add comment

2 Answers

PgRouting implements most of its functionality on C, so it is no "extremely-complex" query. If you use different connections, you can parallelize queries.

So, case 2 timing will depend on your hardware, more than on pgRouting.

share|improve this answer
add comment

Every time you do a query, it doesn't matter if its concurrent or not, postgres/pgrouting loads the data into memory and then computes the shortest path for each particular query.

For example, if you send two queries at the same time, every query will take its own data into memory and compute shortest path, and release it after the computation. It doesn't matter if these data is the same. Memory consumption will be doubled in these case.

Number of concurrent queries depend on size of your data and available memory. You can easily test it by sending one query and looking at memory consumption.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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