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 436ED9DCBCE for ; Sun, 11 Dec 2005 06:52:10 -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 11229-02 for ; Sun, 11 Dec 2005 06:52:10 -0400 (AST) X-Greylist: delayed 00:06:32.057534 by SQLgrey- Received: from smtp1.iitb.ac.in (unknown [202.68.145.249]) by postgresql.org (Postfix) with SMTP id 5C1A99DCAAD for ; Sun, 11 Dec 2005 06:52:04 -0400 (AST) Received: (qmail 16796 invoked from network); 11 Dec 2005 16:15:27 +0530 Received: from unknown (HELO ldns2.iitb.ac.in) (10.200.12.2) by smtp1.iitb.ac.in with SMTP; 11 Dec 2005 16:15:27 +0530 Received: (qmail 17468 invoked by uid 509); 11 Dec 2005 10:45:27 -0000 Received: from 10.105.1.1 by ldns2 (envelope-from , uid 501) with qmail-scanner-1.25st (clamdscan: 0.87.1/1207. spamassassin: 3.1.0. Clear:RC:1(10.105.1.1):. Processed in 0.11071 secs); 11 Dec 2005 10:45:27 -0000 Received: from unknown (HELO cse.iitb.ac.in) (10.105.1.1) by ldns2.iitb.ac.in with SMTP; 11 Dec 2005 10:45:26 -0000 Received: (qmail 19627 invoked by uid 11940); 11 Dec 2005 10:46:00 -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.026899 secs); 11 Dec 2005 10:46:00 -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 10:46:00 -0000 Date: Sun, 11 Dec 2005 16:15:26 +0530 (IST) From: "Anjan Kumar. A." To: pgsql-hackers@postgresql.org, pgsql-chat@postgresql.org, pgsql-benchmarks@postgresql.org, pgsql-docs@postgresql.org cc: Amirishetty Anjan Kumar Subject: Please Help: PostgreSQL Query Optimizer Message-ID: 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.479 required=5 tests=[AWL=0.000, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.479 X-Spam-Level: X-Archive-Number: 200512/1 X-Sequence-Number: 47 I'm working on a project, whose implementation deals with PostgreSQL. A brief description of the project is given below. Project Description: -------------------- In Main Memory DataBase(MMDB) entire database on the disk is loaded on to the main memory during initial startup of the system. There after all the references are made to database on the main memory. When the system is going to shutdown, we will write back the database on the main memory to disk. Here, for the sake of recovery we are writing log records on to the disk during the transaction execution. We want to implement MMDB by modifying PostgreSQL. We implemented our own Main Memory File System to store the primary copy of the database in main memory, and Modified the PostgreSQL to access the data in the Main Memory File System. Now, in our implementation Disk access is completely avoided during normal transaction execution. So, we need to modify the Query Optimizer of PostgreSQL so that it wont consider disk related costs during calculation of Query Costs. Query Optimizer should try to minimize the Processing Cost. The criteria for cost can be taken as the number of tuples that have to read/write from main memory, number of comparisons, etc. Can any one tell me the modifications needs to be incorporated to PostgreSQL, so that it considers only Processing Costs during optimization of the Query. In PostgreSQL, Path costs are measured in units of disk accesses. One sequential page fetch has cost 1. I think, in PostgreSQL following paramters are used in calculating the cost of the Query Path : #random_page_cost = 4 # units are one sequential page fetch cost #cpu_tuple_cost = 0.01 # (same) #cpu_index_tuple_cost = 0.001 # (same) #cpu_operator_cost = 0.0025 # (same) #effective_cache_size = 1000 # typically 8KB each 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; cpu_tuple_cost = 2; cpu_index_tuple_cost = 0.2; cpu_operator_cost = 0.05; Please help us in this regard. I request all of you to give comments/suggestions on this. Waiting for your kind help. -- Thanks. Anjan Kumar A. MTech2, Comp Sci., www.cse.iitb.ac.in/~anjankumar ______________________________________________________________ May's Law: The quality of correlation is inversly proportional to the density of control. (The fewer the data points, the smoother the curves.)