I\'m trying to optimize my function. The thing is when you run the query once you get one result. Run the query a second time or third time the process time is muc
sync; sudo service postgresql stop; echo 1 > /proc/sys/vm/drop_caches; sudo service postgresql start