Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 83CC1475BA1 for ; Tue, 14 Jan 2003 14:44:11 -0500 (EST) Received: from pd6mo1so.prod.shaw.ca (shawidc-mo1.cg.shawcable.net [24.71.223.10]) by postgresql.org (Postfix) with ESMTP id 0DDF2475B8F for ; Tue, 14 Jan 2003 14:44:11 -0500 (EST) Received: from pd6mr1so.prod.shaw.ca (pd6mr1so-qfe3.prod.shaw.ca [10.0.141.216]) by l-daemon (iPlanet Messaging Server 5.1 HotFix 0.8 (built May 12 2002)) with ESMTP id <0H8P00FP3YTNCN@l-daemon> for pgsql-performance@postgresql.org; Tue, 14 Jan 2003 12:44:11 -0700 (MST) Received: from pn2ml5so.prod.shaw.ca (pn2ml5so-qfe0.prod.shaw.ca [10.0.121.149]) by l-daemon (iPlanet Messaging Server 5.1 HotFix 0.8 (built May 12 2002)) with ESMTP id <0H8P003NTYTN5S@l-daemon> for pgsql-performance@postgresql.org; Tue, 14 Jan 2003 12:44:11 -0700 (MST) Received: from kimiko (h24-78-132-76.vc.shawcable.net [24.78.132.76]) by l-daemon (iPlanet Messaging Server 5.1 HotFix 0.8 (built May 12 2002)) with SMTP id <0H8P0088WYTMNK@l-daemon> for pgsql-performance@postgresql.org; Tue, 14 Jan 2003 12:44:11 -0700 (MST) Date: Tue, 14 Jan 2003 11:42:07 -0800 From: Vernon Wu Subject: How good I can get To: pgsql-performance@postgresql.org Reply-To: vernonw@gatewaytech.com Message-id: <65TWVMK3ZVRRMF0DYTHF74KGKE08CA.3e24680f@kimiko> MIME-version: 1.0 X-Mailer: Opera 6.05 build 1140 Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: 7BIT X-Priority: 3 (Normal) X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/108 X-Sequence-Number: 755 In my current project, among of over twenty main tables, three of them are the master tables and result are the multivalued detail tables. All of those table have the field name userid which is varchar data type. A selection statement, having a level of subquery, can involve up to twenty tables. After some query statement tuning and indexing (on all of the multivalued field of all the detail table), a query performance improves spectacularly. The following is the output of ?explain analyze? on a query involved ten tables. NOTICE: QUERY PLAN: Result (cost=0.00..23.42 rows=1 width=939) (actual time=28.00..28.00 rows=0 loops=1) . . . Total runtime: 31.00 msec I would like to find any performance improvement potentiality in terms of DB table design (indexing always can be done later). The first thing I know I can do is to change the join key, userid, to numeral. Since implementing the change requests some work on the system, I would like to know how significant performance improement it can bring. Almost all fields of those tables are a single digit character. I can guess that change them to number type also can improve the selection performance. My question again is how much it can get. The application is a web application. All data on a page is a string, or text type. All number type data has to be parsed from a string to the back-end, and converted into a string from the back end. So that change will have performance overhead on the application. Thanks for your input. Vernon