Re: [HACKERS] Limit changes query plan

2008-02-01 Thread Gaetano Mendola
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Tom Lane wrote: > "Greg Stark" <[EMAIL PROTECTED]> writes: >>> -> Index Scan using i_oa_2_00_dt_for on t_oa_2_00_dt dt (cost=0.00..5.31 >>> rows=1 width=8) (actual time=1.264..1.264 rows=0 loops=50) >>> Index Cond: (dt.card_id = c.id) >>> Filter: ((

Re: [HACKERS] Limit changes query plan

2008-02-01 Thread Tom Lane
"Greg Stark" <[EMAIL PROTECTED]> writes: >> -> Index Scan using i_oa_2_00_dt_for on t_oa_2_00_dt dt (cost=0.00..5.31 >> rows=1 width=8) (actual time=1.264..1.264 rows=0 loops=50) >> Index Cond: (dt.card_id = c.id) >> Filter: ((_to >= 1500) AND (_from <= 1550)) >> Total runtime: 3399960.277 ms >

Re: [HACKERS] Limit changes query plan

2008-02-01 Thread Greg Stark
> -> Index Scan using i_oa_2_00_dt_for on t_oa_2_00_dt dt > (cost=0.00..5.31 rows=1 width=8) (actual time=1.264..1.264 rows=0 loops=50) > Index Cond: (dt.card_id = c.id) > Filter: ((_to >= 1500) AND (_from <= 1550)) > Total runtime: 3399960.277 ms Also, are

Re: [HACKERS] Limit changes query plan

2008-02-01 Thread Tom Lane
Gaetano Mendola <[EMAIL PROTECTED]> writes: > Gregory Stark wrote: >> It's evidently guessing wrong about the limit being satisfied early. The >> non-indexed restrictions might be pruning out a lot more records than the >> planner expects. Or possibly the table is just full of dead records. > Here

Re: [HACKERS] Limit changes query plan

2008-02-01 Thread Gaetano Mendola
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Gregory Stark wrote: > "Gaetano Mendola" <[EMAIL PROTECTED]> writes: > >> I don't get why a limit is going to change the query plan and most of all >> decreasing >> the performances. > > Until we see the explain analyze it won't be clear what exactl

Re: [HACKERS] Limit changes query plan

2008-02-01 Thread Gregory Stark
"Gaetano Mendola" <[EMAIL PROTECTED]> writes: > I don't get why a limit is going to change the query plan and most of all > decreasing > the performances. Until we see the explain analyze it won't be clear what exactly is going on. But in theory a LIMIT can definitely change the plan because the

Re: [HACKERS] Limit changes query plan

2008-02-01 Thread Gaetano Mendola
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Martijn van Oosterhout wrote: > On Fri, Feb 01, 2008 at 12:08:56PM +0100, Gaetano Mendola wrote: >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA1 >> >> Hi all, >> I'm using 8.2.6 and I'm observing a trange behaviour using >> offset and limits. > >

Re: [HACKERS] Limit changes query plan

2008-02-01 Thread Martijn van Oosterhout
On Fri, Feb 01, 2008 at 12:08:56PM +0100, Gaetano Mendola wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hi all, > I'm using 8.2.6 and I'm observing a trange behaviour using > offset and limits. Please post EXPLAIN ANALYZE output so we can see what's actually taking the time. Have

[HACKERS] Limit changes query plan

2008-02-01 Thread Gaetano Mendola
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi all, I'm using 8.2.6 and I'm observing a trange behaviour using offset and limits. This are the two queries that are puzzling me: explain SELECT c.id, tsk, lir, nctr, nctn, ncts, rvel,ecp, pvcp, pvcc,pvcf,pvcl,ldcn,ogtd,sgti FROM t_OA_2_0