Re: Some Improvement

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tim Perdue <tperdue(at)valinux(dot)com>, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Some Improvement
Date: 2000-07-13 05:57:45
Message-ID: 28485.963467865@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>> But I don't see the "Backwards index scan" you mentioned.
> Then we're not there yet.

> I hesitate to suggest that you throw "SET enable_sort TO off" and then
> "SET enable_sort TO on" around your query, because it's so ugly,
> but that might be the best short-term answer.

No, actually that's no short-term answer at all. It turns out that the
"bogus" cost estimate was perfectly correct, because what the planner
was actually generating was a plan for a backwards index scan over the
whole table, with restrictions applied after the fact :-(. Forcing it
to use that plan won't help.

I have corrected this silly oversight. Attached is the patch needed to
make backwards index scans work properly in 7.0.*.

regards, tom lane

*** src/backend/optimizer/path/indxpath.c.orig Sun Apr 16 00:41:01 2000
--- src/backend/optimizer/path/indxpath.c Thu Jul 13 01:49:51 2000
***************
*** 196,202 ****
useful_for_ordering(root, rel, index, ForwardScanDirection))
add_path(rel, (Path *)
create_index_path(root, rel, index,
! NIL,
ForwardScanDirection));
}

--- 196,202 ----
useful_for_ordering(root, rel, index, ForwardScanDirection))
add_path(rel, (Path *)
create_index_path(root, rel, index,
! restrictclauses,
ForwardScanDirection));
}

***************
*** 208,214 ****
if (useful_for_ordering(root, rel, index, BackwardScanDirection))
add_path(rel, (Path *)
create_index_path(root, rel, index,
! NIL,
BackwardScanDirection));

/*
--- 208,214 ----
if (useful_for_ordering(root, rel, index, BackwardScanDirection))
add_path(rel, (Path *)
create_index_path(root, rel, index,
! restrictclauses,
BackwardScanDirection));

/*

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Philip Warner 2000-07-13 06:57:27 Re: Re: postgres TODO
Previous Message Tom Lane 2000-07-13 05:02:09 Re: Some Improvement