Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UrSbK-00087q-7h for pgsql-jdbc@arkaria.postgresql.org; Tue, 25 Jun 2013 12:44:02 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1UrSbJ-0006Xm-OF for pgsql-jdbc@arkaria.postgresql.org; Tue, 25 Jun 2013 12:44:01 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UrSbI-0006Xc-V9 for pgsql-jdbc@postgresql.org; Tue, 25 Jun 2013 12:44:01 +0000 Received: from server.lerner.co.il ([69.55.231.200] helo=lerner.co.il) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UrSbA-0002Jb-E5 for pgsql-jdbc@postgresql.org; Tue, 25 Jun 2013 12:44:00 +0000 Received: by lerner.co.il (Postfix, from userid 1003) id 067D25D6AE3; Tue, 25 Jun 2013 15:43:50 +0300 (IDT) X-DKIM: Sendmail DKIM Filter v2.8.3 lerner.co.il 067D25D6AE3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lerner.co.il; s=MAILOUT; t=1372164230; bh=Q/cDRm2BWNKVRZC+lqZneqJybAeLmgZTr6qVqAM6LyU=; h=Message-ID:Date:From:MIME-Version:To:CC:Subject:References: In-Reply-To:Content-Type:Content-Transfer-Encoding; b=sbRW4WNRjvINcedIxtby25qHs3355+zLb+aKHx5Rz2fKPk+cEF8xUZmkX/qZPJfgG nZOdbYm1MGjGpaOsn+QVWz8MtPhjmlylLwqHuBqXtxdZsIRtR1nLCbxWnOL8uqZLoJ 9kZS/7QR6qkmxrGLE6AqRvF9jZg+e6KxGeI7BOYg= X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on lerner.co.il X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no version=3.3.2 Received: from MacBookPro.local (bzq-79-176-109-145.red.bezeqint.net [79.176.109.145]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: reuven) by lerner.co.il (Postfix) with ESMTPSA id 64F0C5D6812; Tue, 25 Jun 2013 15:43:40 +0300 (IDT) X-DKIM: Sendmail DKIM Filter v2.8.3 lerner.co.il 64F0C5D6812 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lerner.co.il; s=MAILOUT; t=1372164221; bh=Q/cDRm2BWNKVRZC+lqZneqJybAeLmgZTr6qVqAM6LyU=; h=Message-ID:Date:From:MIME-Version:To:CC:Subject:References: In-Reply-To:Content-Type:Content-Transfer-Encoding; b=v+wr7D88WDnGjXNNGxKyGuyd8nlaO6xrTZeUJzLvnKaDcDgW2KcMPuaewt6E9mM88 pR1R6E6YMgGtUzMzP//YMAZvJWYw3Q46RuosX9Rc5HkiR0GiG22fn18YlLvFAqy23W SID0j03Cza4fE4+0vYYb6d3fkSpuuEinhlV23i6A= Message-ID: <51C9907A.9030108@lerner.co.il> Date: Tue, 25 Jun 2013 15:43:38 +0300 From: "Reuven M. Lerner" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 MIME-Version: 1.0 To: Dave Cramer CC: List , kim+pg@alleroedderne.adsl.dk Subject: Re: Bound parameters on Linux are extremely slow (compared to unbound and/or Windows) References: <51A14091.7040909@lerner.co.il> <51A14769.1080409@lerner.co.il> <51A14D8C.7010201@lerner.co.il> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -3.1 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org Hi, everyone. About a month ago, I e-mailed this list about a project I'm helping which is having hugely different performance results depending on whether they use Linux or Windows. Several list members were nice enough to offer some answers, but then I disappeared for a while, thanks to travel + illness + family + crazy schedules. Just to recap: We have an application written in Java. When we build the SQL query manually, using a StringBuilder, we get similar results on Windows and Linux. But when we use the JDBC driver's parameter bindings, we find wildly different performance. Specifically: With binding: Linux: 2,233 ms (yes, more than 2 seconds) Windows: 232 ms Without binding: Linux: 176 ms Windows: 152 ms The two test pieces of code, which we used to benchmark performance, and which work on the table we want to use in production, are at: https://gist.github.com/reuven/5858095 # without bindings https://gist.github.com/reuven/5858092 # with bindings I believe that the tests were run on localhost, such that the client and server were both executing on the same computer. When we execute the query manually, via psql, we get fast results, on both Windows and Linux. Thus, it would seem that something in the parameter-binding code in the JDBC driver is somehow interacting poorly with Linux. I'm far from a Java expert, and even less of a Windows guy, so I'm not sure what is going on here. Any suggestions as to what we should be looking for, or tuning in the PostgreSQL and/or Windows configuration to avoid such problems? Thanks again for any help that you can offer. Reuven -- Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc