On 4/14/2010 9:20 AM, Satish Burnwal (sburnwal) wrote:
Index Scan using repcopy_index on repcopy a (cost=0.00..87824607.17 rows=28 width=142) (actual time=11773.105..689111.440 rows=1 loops=1) Index Cond: ((dm_user)::text = 'u3'::text) Filter: ((report_status = 0) AND (report_time = (subplan))) SubPlan -> Aggregate (cost=3531.30..3531.31 rows=1 width=8) (actual time=58.447..58.448 rows=1 loops=11788) -> Index Scan using repcopy_index on repcopy b (cost=0.00..3526.30 rows=2000 width=8) (actual time=0.017..36.779 rows=25842 loops=11788) Index Cond: ((($0)::text = (dm_user)::text) AND (($1)::text = (dm_ip)::text)) Filter: ((ss_key)::text <> ''::text) Total runtime: 689111.511 ms (9 rows) The estimated cost and actual are way off. Have you run Analyze on the table you may want to change the statistics collected for this table http://www.postgresql.org/docs/8.1/static/planner-stats.html ALTER [ COLUMN ] column SET STATISTICS integerhttp://www.postgresql.org/docs/8.1/static/sql-altertable.html All legitimate Magwerks Corporation quotations are sent in a .PDF file attachment with a unique ID number generated by our proprietary quotation system. Quotations received via any other form of communication will not be honored. CONFIDENTIALITY NOTICE: This e-mail, including attachments, may contain legally privileged, confidential or other information proprietary to Magwerks Corporation and is intended solely for the use of the individual to whom it addresses. If the reader of this e-mail is not the intended recipient or authorized agent, the reader is hereby notified that any unauthorized viewing, dissemination, distribution or copying of this e-mail is strictly prohibited. If you have received this e-mail in error, please notify the sender by replying to this message and destroy all occurrences of this e-mail immediately. Thank you. |