Re: Indexes with descending date columns

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, Bruce,

Bruce Momjian wrote:

>>Ahh. There's a hack to do that by defining a new opclass that reverses <
>>and >, and then doing ORDER BY project_id, id, date USING new_opclass.
>>
>>I think there's a TODO about this, but I'm not sure...
> 
> Yes, and updated:
> 
> 	* Allow the creation of indexes with mixed ascending/descending
> 	  specifiers
> 	
> 	  This is possible now by creating an operator class with reversed sort
> 	  operators.  One complexity is that NULLs would then appear at the start
> 	  of the result set, and this might affect certain sort types, like
> 	  merge join.

I think it would be better to allow "index zig-zag scans" for
multi-column index.[1]

So it traverses in a given order on the higher order column, and the sub
trees for each specific high order value is traversed in reversed order.

[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux