X-Original-To: pgsql-admin@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 954F147636B for ; Tue, 13 May 2003 13:19:57 -0400 (EDT) Received: from web21101.mail.yahoo.com (web21101.mail.yahoo.com [216.136.227.103]) by postgresql.org (Postfix) with SMTP id 85826474E42 for ; Tue, 13 May 2003 13:19:56 -0400 (EDT) Message-ID: <20030513171955.37103.qmail@web21101.mail.yahoo.com> Received: from [208.253.218.33] by web21101.mail.yahoo.com via HTTP; Tue, 13 May 2003 10:19:55 PDT Date: Tue, 13 May 2003 10:19:55 -0700 (PDT) From: Shankar K Subject: Re: database running slow To: Andrew Sullivan , pgsql-admin@postgresql.org In-Reply-To: <20030513121419.GC17278@libertyrms.info> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Status: No, hits=-9.1 required=5.0 tests=BAYES_01,FROM_ENDS_IN_NUMS,IN_REP_TO autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200305/151 X-Sequence-Number: 8713 > Since our application involves high inserts/deletes, > we vacuum/analyze major tables thrice a day. Apart > from this Be sure you really need the vacuum before you do it. ++ yes i normally vacuum/analyze only tables with huge inserts/deletes and others once a week. Remember, vacuum destroys your buffers, so it's not free. On certain kinds of tables, it can be worth it to do a vacuum very often (we have some we do once an hour). > 1. how to identify run-away sql backends Define "run-away". You can look for long-running transactions; that might be helpful. ++ i meant a backend process taking most of the cpu cycles and running for ever. so i wanted to figure out what those processes were doing and what made them to hog the cpu cycles. how to look for long-running transactions ? > 2. find out the bad sqls thats causing trouble Look for queries that take a long time. EXPLAIN ANALYSE is your friend. ++ how to identify those queries. once i have the queries identified then i can do explain analyze and tune accordingly. Is there equivalent of oracle sql_trace in postgres ? thanks for you help Shankar __________________________________ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo. http://search.yahoo.com