I'm developing a Java application where I have to implement Shortest path algorithm (dijkstra's).
I've stored the details of nodes in database.

But my problem is that the number of nodes is very large (1000+) and taking all the nodes into consideration will increase the time and space consumption of the application.

Also taking such large number of nodes into consideration will be inefficient as many nodes will be irrelevant in finding the shortest path.

Hence, I'm looking for a solution this problem.

I don't want the code, I just want the idea/method to solve it.
So, please suggest me some method.

Thank you for the reply. But still my problem is not solved.
I want a method of finding the shortest distance which does not consider all the nodes(1000+) in finding the path.

You said you had already selected the method and that it was Dijkstra's Method. Also, how can you not consider all the nodes? If you have 1000 nodes and you only look at 999 of them, how do you know that the 1000th node, the one you don't look at, isn't one of the nodes on the shortest path?