Re: [GENERAL] Backwards index scan

2006-06-07 Thread John Sidney-Woollett
Thanks for putting me straight - I thought I remembered a previous post from Tom about nulls not being indexed but it was probably referring to partial indexes not indexing values that are null... Coalescing null values might still be helpful to ensure that they are ordered in the index at a s

Re: [GENERAL] Backwards index scan

2006-06-06 Thread Greg Stark
John Sidney-Woollett <[EMAIL PROTECTED]> writes: > I don't think that null values are indexed - you'll probably need to coalesce > your null data value to some value if you want it indexed. That is most definitely not true for Postgres. NULL values are included in the index. However NULLs sort

Re: [GENERAL] Backwards index scan

2006-06-06 Thread Andrew Sullivan
On Tue, Jun 06, 2006 at 12:27:33PM -0400, Carlos Oliva wrote: > Thank for your response Alan. This indeed corrects the problem as long as > we configure the database to enable_seqscan=false. If you have to do that, something is still wrong. Do you have accurate statistics? Is the planner mistak

Re: [GENERAL] Backwards index scan

2006-06-06 Thread John Sidney-Woollett
--Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Alan Hodgson Sent: Tuesday, June 06, 2006 11:05 AM To: pgsql-general@postgresql.org Subject: Re: [GENERAL] Backwards index scan On June 6, 2006 07:59 am, "Carlos Oliva" <[EMAIL PROTECTED]> wr

Re: [GENERAL] Backwards index scan

2006-06-06 Thread Carlos Oliva
in advance for your response. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Alan Hodgson Sent: Tuesday, June 06, 2006 11:05 AM To: pgsql-general@postgresql.org Subject: Re: [GENERAL] Backwards index scan On June 6, 2006 07:59 am, "Carlos Oliva&quo

Re: [GENERAL] Backwards index scan

2006-06-06 Thread Alan Hodgson
On June 6, 2006 07:59 am, "Carlos Oliva" <[EMAIL PROTECTED]> wrote: > We are conducting a simple test to asses if the optimizer ever uses the > index. The table has several columns and the select statement is as > follows: select * from ord0007 order by prtnbr, ordschdte desc. The > index that we

[GENERAL] Backwards index scan

2006-06-06 Thread Carlos Oliva
Are there any configurations/flags that we should re-set for the database (v 7.4.x) in order to enable a backwards scan on an index?  We are trying to query a table in descending order.  We added an index that we were hoping would be scanned backwards but EXPLAIN never indicates that the op

Re: [GENERAL] Backwards index scan

2003-07-07 Thread Dmitry Tkach
If you make an opclass that orders in the reverse order you can use that opclass in creating the index (which effectively can give you an index like x, y desc by using the new opclass on y). There was some talk recently about whether we should provide such opclasses as builtins or contrib items.

Re: [GENERAL] Backwards index scan

2003-07-07 Thread Stephan Szabo
On Mon, 7 Jul 2003, Dmitry Tkach wrote: > I understand that with the generic approach to operators in postgres it > is, probably, not very feasible to try and teach _bt_first () to handle > this situation automatically (it would need to know how to get > next/previous value for every indexable ty

[GENERAL] Backwards index scan

2003-07-07 Thread Dmitry Tkach
I am not sure if this is really a bug, but it certainly looks like one to me... I have a table that looks something like this: create table huge_table ( int x, int y ); create index huge_table_idx on huge_table (x,y); It contains about 80 million rows... I am trying to get those rows that