Re: Problems with order by, limit, and indices - Mailing list pgsql-general

From Denis Perchine
Subject Re: Problems with order by, limit, and indices
Date
Msg-id 01010717021500.11873@dyp.perchine.com
Whole thread Raw
In response to Re: Problems with order by, limit, and indices  (Denis Perchine <dyp@perchine.com>)
Responses Re: Problems with order by, limit, and indices  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Hi,

another interesting thing...
This is current 7.1.

slygreetings=> explain select * from users where variant_id=5 AND active='f'
order by rcptdate,variant_id,active limit 60;
NOTICE:  QUERY PLAN:

Limit  (cost=13005.10..13005.10 rows=60 width=145)
  ->  Sort  (cost=13005.10..13005.10 rows=3445 width=145)
        ->  Index Scan using users_rcptdate_vid_key on users
(cost=0.00..12658.35 rows=3445 width=145)

EXPLAIN
slygreetings=> set enable_sort to off;
SET VARIABLE
slygreetings=> explain select * from users where variant_id=5 AND active='f'
order by rcptdate,variant_id,active limit 60;
NOTICE:  QUERY PLAN:

Limit  (cost=100013005.10..100013005.10 rows=60 width=145)
  ->  Sort  (cost=100013005.10..100013005.10 rows=3445 width=145)
        ->  Index Scan using users_rcptdate_vid_key on users
(cost=0.00..12658.35 rows=3445 width=145)

EXPLAIN

Cost is something really wierd.... Why?

--
Sincerely Yours,
Denis Perchine

----------------------------------
E-Mail: dyp@perchine.com
HomePage: http://www.perchine.com/dyp/
FidoNet: 2:5000/120.5
----------------------------------

pgsql-general by date:

Previous
From: Mihail Marinov
Date:
Subject: Re[2]: DROP SEQUENCE ?
Next
From: Marko Kreen
Date:
Subject: Re: using crypt authentication