Re: Performance With Joins on Large Tables - Mailing list pgsql-performance

From Joshua Marsh
Subject Re: Performance With Joins on Large Tables
Date
Msg-id 38242de90609131227q4837d1cekc50bc1a450175bec@mail.gmail.com
Whole thread Raw
In response to Re: Performance With Joins on Large Tables  (Jeff Davis <pgsql@j-davis.com>)
List pgsql-performance
> Hmm... that sounds bad. I'm sure your system will always choose indexes
> with that value.
>
> Is it overestimating the cost of using indexes or underestimating the
> cost of a seq scan, or both? Maybe explain with the 0.1 setting will
> help?
>
> Regards,
>        Jeff Davis

data=# explain SELECT v.phonedirect, v.editdrop, EXTRACT (EPOCH FROM
v.custdate), EXTRACT (EPOCH FROM s.custdate) FROM view_505 v INNER
JOIN r3s169 s on v.dsiacctno = s.dsiacctno;
                                                QUERY PLAN
-----------------------------------------------------------------------------------------------------------
 Merge Join  (cost=0.00..51808909.26 rows=285230272 width=11)
   Merge Cond: ("outer".dsiacctno = "inner".dsiacctno)
   ->  Index Scan using view_505_dsiacctno on view_505 v
(cost=0.00..12755411.69 rows=112393848 width=20)
   ->  Index Scan using r3s169_dsiacctno on r3s169 s
(cost=0.00..32357747.90 rows=285230272 width=17)
(4 rows)

This is what I wanted, two index scans.  Just to give you an idea of
the difference in time, this plan would allow me to process 100,000
records ever few seconds, while the sequential scan would only
produces 100,000 every 10 minutes.

pgsql-performance by date:

Previous
From: "Joshua Marsh"
Date:
Subject: Re: Query Progress (was: Performance With Joins on Large Tables)
Next
From: "Merlin Moncure"
Date:
Subject: Re: sql-bench