X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B17DC9DC93D for ; Mon, 9 Jan 2006 01:09:52 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72234-08 for ; Mon, 9 Jan 2006 01:09:51 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linux.dunaweb.hu (linux.dunaweb.hu [62.77.196.1]) by postgresql.org (Postfix) with ESMTP id 479D39DC9AB for ; Mon, 9 Jan 2006 01:09:49 -0400 (AST) Received: from localhost (linux.dunaweb.hu [127.0.0.1]) by linux.dunaweb.hu (Postfix) with ESMTP id C004C8E077B for ; Mon, 9 Jan 2006 06:09:48 +0100 (CET) Received: from linux.dunaweb.hu ([127.0.0.1]) by localhost (linux.dunaweb.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 03514-07 for ; Mon, 9 Jan 2006 06:09:48 +0100 (CET) Received: from [81.17.177.202] (host-81-17-177-202.dunaweb.hu [81.17.177.202]) by linux.dunaweb.hu (Postfix) with ESMTP id 318808E0751 for ; Mon, 9 Jan 2006 06:09:48 +0100 (CET) Message-ID: <43C1F84A.90707@dunaweb.hu> Date: Mon, 09 Jan 2006 06:44:42 +0100 From: Zoltan Boszormenyi User-Agent: Mozilla Thunderbird 1.0.7-1.1.fc3 (X11/20050929) X-Accept-Language: hu-hu, hu, en-us, en MIME-Version: 1.0 To: pgsql-odbc@postgresql.org Subject: PsqlODBC slow on UNION queries Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at dunaweb.hu X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200601/68 X-Sequence-Number: 6883 Hi, we are using PowerBuilder for development and I experimented a little with PostgreSQL-8.1 through ODBC and I experienced the following on psqlodbc-8.01.0106. We have some large views, consisting of 6+ UNION members. Recently, I rewrote them to use UNION ALL, since the members give distinct rows across the whole view. The performance difference between the two is enormous, e.g. using UNION, the rows starts flowing only after 30-32 seconds but when using UNION ALL, it starts instantly. Doing the same in psql like below runs under 4 seconds using UNION and under about 12 seconds using UNION ALL, and this includes getting all the rows from the server. time echo "select * from view_x" | psql db >result.txt What may cause such a large difference?