Thank you. I ran manually analyze command. After that query runs fast. I have enabled autovacuum and statitics collection in config file. Every day a lot of rows are added to dok table. However it seems that statitics is not collected (autovacuum is not running) Any idea autovacuum is not running ? Andrus. ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings