Thank you everyone for your valuable input! I will have a look at some other part of PostgreSQL, and maybe find something else to do instead.
Best, Georgi ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend