Add index to roadsnodesinorder
Use WHERE IN instead of multiple FROM

Performance impact (Finland data set):

Before:
  (cost=0.87..1081189.94 rows=4412259 width=16)
  (actual time=0.079..11683.169 rows=4772003 loops=1)

After:
  (cost=3.69..965508.03 rows=4412259 width=16)
  (actual time=0.048..9823.452 rows=4772003 loops=1)
Add a primary key and constraints to roadsnodesdata