Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 7D1B5475F28 for ; Fri, 1 Nov 2002 06:15:55 -0500 (EST) Received: from rtlocal.trade-india.com (mail-relay.trade-india.com [203.196.129.235]) by postgresql.org (Postfix) with SMTP id 4F001475E25 for ; Fri, 1 Nov 2002 06:15:51 -0500 (EST) Received: (qmail 22127 invoked from network); 1 Nov 2002 11:03:34 -0000 Received: from news1.trade-india.com (HELO www.trade-india.com) (130.94.20.27) by infocom-236-129-del.trade-india.com with SMTP; 1 Nov 2002 11:03:34 -0000 Received: (qmail 7858 invoked by uid 99); 1 Nov 2002 11:15:43 -0000 Received: from 203.145.130.142 (SquirrelMail authenticated user mallah) by mail.trade-india.com with HTTP; Fri, 1 Nov 2002 16:45:43 +0530 (IST) Message-ID: <1584.203.145.130.142.1036149343.squirrel@mail.trade-india.com> Date: Fri, 1 Nov 2002 16:45:43 +0530 (IST) Subject: Is dump-reload the only cure? From: To: X-Priority: 3 Importance: Normal X-MSMail-Priority: Normal Cc: X-Mailer: SquirrelMail (version 1.2.6) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200211/4 X-Sequence-Number: 6192 Hi , For a particular table it was only dump and reload of the table that helped in enabling index usage. I tried VACUUM ANALYZE and even recreating the indexes but it did not work. why does the planner use the index like a miser? below are the details was there anything bettwer i could have done for indexes getting used? regds mallah. Query: explain SELECT count( email_id ) from email_bank_mailing_lists where query_id='499'; NOTICE: QUERY PLAN: Aggregate (cost=4330.48..4330.48 rows=1 width=4) -> Index Scan using email_bank_ml_qid on email_bank_mailing_lists (cost=0.00..4327.28 rows=1282 width=4) EXPLAIN distribution of query_id in table: total: 256419 query_id | count(*) ---------------------- 298 | 6167 328 | 2083 354 | 9875 404 | 6974 432 | 5059 437 | 2497 440 | 2837 448 | 14624 449 | 13053 454 | 409 455 | 3725 456 | 560 458 | 3477 460 | 5561 486 | 41842 488 | 63642 492 | 2244 493 | 6047 494 | 37415 499 | 25010 501 | 3318 before dump reload: tradein_clients=# VACUUM VERBOSE ANALYZE email_bank_mailing_lists; NOTICE: --Relation email_bank_mailing_lists-- NOTICE: Pages 3583: Changed 0, Empty 0; Tup 256419: Vac 0, Keep 0, UnUsed 44822. Total CPU 0.24s/0.04u sec elapsed 0.30 sec. NOTICE: Analyzing email_bank_mailing_lists VACUUM tradein_clients=# explain SELECT count( email_id ) from email_bank_mailing_lists where query_id=499;NOTICE: QUERY PLAN: Aggregate (cost=6863.24..6863.24 rows=1 width=4) -> Seq Scan on email_bank_mailing_lists (cost=0.00..6788.24 rows=30001 width=4) EXPLAIN ----------------------------------------- Get your free web based email at trade-india.com. "India's Leading B2B eMarketplace.!" http://www.trade-india.com/