Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 83F789FA02C for ; Mon, 11 Dec 2006 14:36:41 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 10837-10 for ; Mon, 11 Dec 2006 14:36:41 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from exprod6og55.obsmtp.com (exprod6og55.obsmtp.com [64.18.1.191]) by postgresql.org (Postfix) with SMTP id 5EB3F9F9FE1 for ; Mon, 11 Dec 2006 14:36:40 -0400 (AST) Received: from source ([63.240.6.44]) by exprod6ob55.postini.com ([64.18.5.12]) with SMTP; Mon, 11 Dec 2006 10:36:38 PST Received: from 172.16.1.25 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D4)); Mon, 11 Dec 2006 13:31:01 -0500 X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 Received: from MI8NYCMAIL08.Mi8.com ([172.16.1.164]) by D01HOST03.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 11 Dec 2006 13:30:57 -0500 Received: from 69.181.100.71 ([69.181.100.71]) by MI8NYCMAIL08.Mi8.com ( [172.16.1.190]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.106]) with Microsoft Exchange Server HTTP-DAV ; Mon, 11 Dec 2006 18:30:57 +0000 User-Agent: Microsoft-Entourage/11.2.5.060620 Date: Mon, 11 Dec 2006 10:30:55 -0800 Subject: Re: New to PostgreSQL, performance considerations From: "Luke Lonergan" To: "Michael Stone" , pgsql-performance@postgresql.org Message-ID: Thread-Topic: [PERFORM] New to PostgreSQL, performance considerations Thread-Index: AccdUn59vMxA7olFEdu/8AAWy4o9DA== In-Reply-To: <20061211173105.GH16692@mathom.us> MIME-Version: 1.0 X-OriginalArrivalTime: 11 Dec 2006 18:30:57.0927 (UTC) FILETIME=[803BB970:01C71D52] X-WSS-ID: 69637C6F27010374823-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200612/251 X-Sequence-Number: 22307 Michael, On 12/11/06 9:31 AM, "Michael Stone" wrote: > [1] I will say that I have never seen a realistic benchmark of general > code where the compiler flags made a statistically significant > difference in the runtime. Here's one - I wrote a general purpose Computational Fluid Dynamics analysis method used by hundreds of people to perform aircraft and propulsion systems analysis. Compiler flag tuning would speed it up by factors of 2-3 or even more on some architectures. The reason it was so effective is that the structure of the code was designed to be general, but also to expose the critical performance sections in a way that the compilers could use - deep pipelining/vectorization, unrolling, etc, were carefully made easy for the compilers to exploit in critical sections. Yes, this made the code in those sections harder to read, but it was a common practice because it might take weeks of runtime to get an answer and performance mattered. The problem I see with general purpose DBMS code the way it's structured in pgsql (and others) is that many of the critical performance sections are embedded in abstract interfaces that obscure them from optimization. An example is doing a simple "is equal to" operation has many layers surrounding it to ensure that UDFs can be declared and that special comparison semantics can be accomodated. But if you're simply performing a large number of INT vs. INT comparisons, it will be thousands of times slower than a CPU native operation because of the function call overhead, etc. I've seen presentations that show IPC of Postgres at about 0.5, versus the 2-4 possible from the CPU. Column databases like C-Store remove these abstractions at planner time to expose native operations in large chunks to the compiler and the IPC reflects that - typically 1+ and as high as 2.5. If we were to redesign the executor and planner to emulate that same structure we could achieve similar speedups and the compiler would matter more. - Luke