Hello, continuing the saga, http://archives.postgresql.org/pgsql-performance/2006-04/msg00558.php , my coleague created a test database with fake data (see below). The above archived message contains the the timings of firebird and postgresql. The weird problem are the 2 queries that firebird executes in less than 2 seconds and postgresql took almost half hour to complete at 100% cpu. you could download the test database at the address below. It is a 128 kpbs adsl connection. 74 MB http://www.eicomm.no-ip.com/download/BackDNF_Cript.zip Many thanks. Andre Felipe Machado