"Uwe C. Schroeder" <[EMAIL PROTECTED]> writes: > I could create a view for every node in the system which calculates the > distance in the result set, making it easy to handle for the application: > select * from <view> where distance <= 50 > The problem is, that the data will possibly contain thousands of nodes. I'd > also need 2 or 3 views per node - which could lead to 50.000 or even 100.000 > views.
Normalize. Make your view construct the distance for _every_ node. So your query looks like: select * from <view> where node_id = 99 and distance <= 50 The danger here is you have to be absolutely sure that Postgres is pushing that clause down into your view or the performance will be bad. But if your view is at all sane then I think it will. And you'll certainly know if it isn't. -- greg ---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])