Mapeditor query optimisation

Use PostreSQL cursor instead of caching entire table in memory.Use primary key and system key for row filter in map editor.