Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 360C82E002C for ; Tue, 25 Mar 2008 09:24:34 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 31926-10 for ; Tue, 25 Mar 2008 09:24:23 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from www.postnewspapers.com.au (www.postnewspapers.com.au [202.61.230.242]) by postgresql.org (Postfix) with ESMTP id A975B2E003B for ; Tue, 25 Mar 2008 09:24:29 -0300 (ADT) Received: from mail.postnewspapers.com.au (202-89-185-120.static.dsl.amnet.net.au [202.89.185.120]) by www.postnewspapers.com.au (Postfix) with ESMTP id 996EDD55AE for ; Tue, 25 Mar 2008 21:24:25 +0900 (WST) Received: from localhost (access [127.0.0.1]) by mail.postnewspapers.com.au (Postfix) with ESMTP id C69771E0435 for ; Tue, 25 Mar 2008 21:24:26 +0900 (WST) X-Virus-Scanned: Debian amavisd-new at postnewspapers.com.au Received: from mail.postnewspapers.com.au ([127.0.0.1]) by localhost (access.postnewspapers.com.au [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 864wGRZYgybP for ; Tue, 25 Mar 2008 21:24:24 +0900 (WST) Received: from [203.161.97.213] (203.161.97.213.static.amnet.net.au [203.161.97.213]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "Craig Ringer", Issuer "POST Certificate Authority" (verified OK)) by mail.postnewspapers.com.au (Postfix) with ESMTP id 379631E0434 for ; Tue, 25 Mar 2008 21:24:24 +0900 (WST) Message-ID: <47E8EEF1.40709@postnewspapers.com.au> Date: Tue, 25 Mar 2008 21:24:17 +0900 From: Craig Ringer User-Agent: Thunderbird 2.0.0.12 (Windows/20080213) MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: what is the maximum number of rows in a table in postgresql 8.1 References: <7be3f35d0803250448h62f47b13mebe0252fca9b90e1@mail.gmail.com> <20080325120101.GC6756@alvh.no-ip.org> In-Reply-To: X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200803/469 X-Sequence-Number: 29423 sathiya psql wrote: > > yes many a times i need to process all the records, > > often i need to use count(*) ???? > > so what to do ?? ( those trigger options i know already, but i wil l do > count on different parameters ) *** PLEASE *** post the output of an EXPLAIN ANALYSE on one or more of your queries, and POST THE QUERY TEXT TOO. For example, if your query was: SELECT COUNT(*) FROM sometable WHERE somefield > 42 ; then you would run: ANALYZE sometable; then you would run: EXPLAIN ANALYZE SELECT COUNT(*) FROM sometable WHERE somefield > 42 ; and paste the resulting text into an email message to this list. Without your query text and the EXPLAIN ANALYZE output from it it is much harder for anybody to help you. You should also post the output of a psql "\d" command on your main table definitions. As for what you can do to improve performance, some (hardly an exclusive list) of options include: - Maintaining a summary table using a trigger. The summary table might track counts for various commonly-searched-for criteria. Whether this is practical or not depends on your queries, which you have still not posted to the list. - Tuning your use of indexes (adding, removing, or adjusting indexes to better service your queries). Use EXPLAIN ANALYZE to help with this, and READ THE MANUAL, which has excellent information on tuning index use and profiling queries. - Tune the query planner parameters to make better planning decisions. In particular, if your data and indexes all fit in ram you should reduce the cost of index scans relative to sequential scans. There is plenty of information about that on this mailing list. Also, READ THE MANUAL, which has excellent information on tuning the planner. - Investigating table partitioning and tablespaces (this requires considerable understanding of postgresql to use successfully). You probably want to avoid this unless you really need it, and I doubt it will help much for in-memory databases anyway. - Buy a faster computer -- Craig Ringer