Hello, Many thanks for your suggestions. I am trying to optimize server configs, as (presumed) my friend already optimized his queries and firebird windows is executing them fast. You could see at the new attached file the results of the queries rewrite. Unfortunately, the first query simply returned the same estimated costs by the planner. The second one, using EXISTS, multiplied its cost almost 200 times! "Exists" is painfully slow. The shared_buffers was reduced again. Do you have any suggestions? Many thanks. Andre Felipe Machado
Attachment:
sql_query_rewrite.txt.tar.gz
Description: GNU Zip compressed data