X-Original-To: pgsql-benchmarks-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id EDB5A9DD5EE for ; Sun, 11 Dec 2005 18:06:08 -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 46701-06 for ; Sun, 11 Dec 2005 18:06:09 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp1.iitb.ac.in (unknown [202.68.145.249]) by postgresql.org (Postfix) with SMTP id 5064C9DD56B for ; Sun, 11 Dec 2005 18:06:03 -0400 (AST) Received: (qmail 9663 invoked from network); 12 Dec 2005 03:36:02 +0530 Received: from unknown (HELO ldns1.iitb.ac.in) (10.200.12.1) by smtp1.iitb.ac.in with SMTP; 12 Dec 2005 03:36:02 +0530 Received: (qmail 19696 invoked by uid 509); 11 Dec 2005 22:06:02 -0000 Received: from 10.105.1.1 by ldns1 (envelope-from , uid 501) with qmail-scanner-1.25 (clamdscan: 0.87.1/1207. spamassassin: 3.1.0. Clear:RC:1(10.105.1.1):. Processed in 0.107596 secs); 11 Dec 2005 22:06:02 -0000 Received: from unknown (HELO cse.iitb.ac.in) (10.105.1.1) by ldns1.iitb.ac.in with SMTP; 11 Dec 2005 22:06:02 -0000 Received: (qmail 9659 invoked by uid 11940); 11 Dec 2005 22:06:34 -0000 Received: from 10.105.11.33 by jeeves.cse.iitb.ac.in (envelope-from , uid 11926) with qmail-scanner-1.25 (clamdscan: 0.87/1207. spamassassin: 3.1.0. Clear:RC:1(10.105.11.33):. Processed in 0.026123 secs); 11 Dec 2005 22:06:34 -0000 Received: from nsl-33.cse.iitb.ac.in ([10.105.11.33]) (envelope-sender ) by cse.iitb.ac.in (qmail-ldap-1.03) with SMTP for ; 11 Dec 2005 22:06:34 -0000 Date: Mon, 12 Dec 2005 03:36:01 +0530 (IST) From: "Anjan Kumar. A." To: pgsql-hackers@postgresql.org cc: pgsql-chat@postgresql.org, pgsql-benchmarks@postgresql.org, pgsql-docs@postgresql.org Subject: Re: [HACKERS] Please Help: PostgreSQL Query Optimizer In-Reply-To: <200512111126.18566.josh@agliodbs.com> Message-ID: References: <200512111126.18566.josh@agliodbs.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.348 required=5 tests=[AWL=-0.131, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.348 X-Spam-Level: X-Archive-Number: 200512/3 X-Sequence-Number: 49 Since sequential access is not significantly faster than random access in a MMDB, random_page_cost will be approximately same as sequential page fetch cost. As every thing is present in Main Memory, we need to give approximately same cost to read/write to Main Memory and CPU Related operations. But, in PostgreSQL all costs are scaled relative to a page fetch. If we make both sequential_page_fetch_cost and random_page_cost to "1", then we need to increase the various cpu_* paramters by multiplying the default values with appropriate Scaling Factor. Now, we need to determine this Scaling Factor. Still, i want to confirm whether this approach is the correct one. On Sun, 11 Dec 2005, Josh Berkus wrote: > Anjan, > >> In our case we are reading pages from Main Memory File System, but not from >> Disk. Will it be sufficient, if we change the default values of above >> paramters in "src/include/optimizer/cost.h and >> src/backend/utils/misc/postgresql.conf.sample" as follows: >> >> random_page_cost = 4; > > This should be dramatically lowered. It's supposed to represent the ratio of > seek-fetches to seq scans on disk. Since there's no disk, it should be a > flat 1.0. However, we are aware that there are flaws in our calculations > involving random_page_cost, such that the actual number for a system where > there is no disk cost would be lower than 1.0. Your research will hopefully > help us find these flaws. > >> cpu_tuple_cost = 2; >> cpu_index_tuple_cost = 0.2; >> cpu_operator_cost = 0.05; > > I don't see why you're increasing the various cpu_* costs. CPU costs would be > unaffected by the database being in memory. In general, I lower these by a > divisor based on the cpu speed; for example, on a dual-opteron system I lower > the defaults by /6. However, that's completely unrelated to using an MMDB. > > So, other than random_page_cost, I don't know of other existing GUCs that > would be directly related to using a disk/not using a disk. How are you > handling shared memory and work memory? > > I look forward to hearing more about your test! > > -- Regards. Anjan Kumar A. MTech2, Comp Sci., www.cse.iitb.ac.in/~anjankumar ______________________________________________________________ Do not handicap your children by making their lives easy. -- Robert Heinlein