Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id D71AF6343C1 for ; Fri, 19 Mar 2010 14:39:34 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 97950-01 for ; Fri, 19 Mar 2010 17:39:24 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from 30.mail-out.ovh.net (30.mail-out.ovh.net [213.186.62.213]) by mail.postgresql.org (Postfix) with SMTP id 1F4AC633E26 for ; Fri, 19 Mar 2010 14:39:23 -0300 (ADT) Received: (qmail 19789 invoked by uid 503); 19 Mar 2010 17:47:22 -0000 Received: from b9.ovh.net (HELO mail419.ha.ovh.net) (213.186.33.59) by 30.mail-out.ovh.net with SMTP; 19 Mar 2010 17:47:22 -0000 Received: from b0.ovh.net (HELO queueout) (213.186.33.50) by b0.ovh.net with SMTP; 19 Mar 2010 17:39:21 -0000 Received: from par69-8-88-161-102-87.fbx.proxad.net (HELO localhost) (lists%peufeu.com@88.161.102.87) by ns0.ovh.net with SMTP; 19 Mar 2010 17:39:20 -0000 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: Corin , pgsql-performance@postgresql.org Subject: Re: mysql to postgresql, performance questions References: <4BA23936.2030507@gmail.com> Date: Fri, 19 Mar 2010 18:34:53 +0100 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: "Pierre C" Message-ID: In-Reply-To: <4BA23936.2030507@gmail.com> User-Agent: Opera Mail/10.10 (Linux) X-Ovh-Tracer-Id: 13170777111439476428 X-Ovh-Remote: 88.161.102.87 (par69-8-88-161-102-87.fbx.proxad.net) X-Ovh-Local: 213.186.33.20 (ns0.ovh.net) X-Spam-Check: DONE|U 0.5/N X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201003/242 X-Sequence-Number: 38067 > I also wonder why the reported runtime of 5.847 ms is so much different > to the runtime reported of my scripts (both php and ruby are almost the > same). What's the best tool to time queries in postgresql? Can this be > done from pgadmin? I've seen differences like that. Benchmarking isn't easy. The client libraries, the particular language bindings you use, the connection... all that can add overhead that is actually mych larger that what you're trying to measure. - On "localhost", some MySQL distros will default to a UNIX Socket, some Postgres distros will default to a TCP socket, or even SSL, and vice versa. Needless to say, on a small query like "SELECT * FROM users WHERE user_id=$1", this makes a lot of difference, since the query time (just a few tens of microseconds) is actually shorter than the TCP overhead. Depending on how you connect you can get a 2-3x variation in throughput with client and server on the same machine, just between TCP and UNIX socket. On queries that retrieve lots of data, overheads are also quite different (especially with SSL...) - I've seen postgres saturate a 1 GB/s ethernet link between server and client during benchmark. - Performance depends a LOT on your language bindings. For instance : php : PDO is quite a lot slower than pg_query() especially if you use prepared statements which are used only once, python : psycopg, pygresql, mysql-python behave quite differently (psycopg being by far the fastest of the bunch), especially when retrieving lots of results, and converting those results back to python types... So, what are you benchmarking exactly ?...