X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 5FB8911F60B0 for ; Tue, 25 Apr 2006 23:06:49 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 83526-06-2 for ; Tue, 25 Apr 2006 23:06:34 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 7E22611F6093 for ; Tue, 25 Apr 2006 23:06:29 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k3Q26TvD011304; Tue, 25 Apr 2006 22:06:29 -0400 (EDT) To: "andremachado" cc: pgsql-performance@postgresql.org Subject: Re: Firebird 1.5.3 X Postgresql 8.1.3 (linux and windows) In-reply-to: <20060425160609.M20649@techforce.com.br> References: <20060425160609.M20649@techforce.com.br> Comments: In-reply-to "andremachado" message dated "Tue, 25 Apr 2006 14:38:16 -0200" Date: Tue, 25 Apr 2006 22:06:29 -0400 Message-ID: <11303.1146017189@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200604/591 X-Sequence-Number: 18675 "andremachado" writes: > After some time experimenting on windows, the conclusion is clear: > windows is likely crap for databases other than MS-SQL. Maybe. One thing that comes to mind is that you really should do some performance tuning experiments. In particular it'd be a good idea to increase checkpoint_segments and try other settings for wal_sync_method. Your fifth query, bddnf=# explain analyze update NOTA_FISCAL set VA_TOTAL_ITENSDNF = (select sum(ITEM_NOTA.VA_TOTAL) from ITEM_NOTA where ITEM_NOTA.ID_NF = NOTA_FISCAL.ID_NF) where ID_NF in (select NF2.ID_NF from DECLARACAO DE inner join CADASTRO CAD on (CAD.ID_DECLARACAO=DE.ID_DECLARACAO) inner join NOTA_FISCAL NF2 on (NF2.ID_CADASTRO=CAD.ID_CADASTRO) where DE.ID_ARQUIVO in (1) ); shows runtime of the plan proper as 158 seconds but total runtime as 746 seconds --- the discrepancy has to be associated with writing out the updated rows, which there are a lot of (719746) in this query, but still we should be able to do it faster than that. So I surmise a bottleneck in pushing WAL updates to disk. The last two queries are interesting. Does Firebird have any equivalent of EXPLAIN, ie a way to see what sort of query plan they are using? I suspect they are being more aggressive about optimizing the max() functions in the sub-selects than we are. In particular, the 8.1 code for optimizing min/max just punts if it sees any sub-selects in the WHERE clause, which prevents us from doing anything with these examples. /* * Also reject cases with subplans or volatile functions in WHERE. This * may be overly paranoid, but it's not entirely clear if the * transformation is safe then. */ if (contain_subplans(parse->jointree->quals) || contain_volatile_functions(parse->jointree->quals)) return NULL; This is something I'd wanted to go back and look at more carefully, but never got around to. regards, tom lane