| From: | Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> |
|---|---|
| To: | me(at)alternize(dot)com |
| Cc: | Michael Glaesemann <grzm(at)myrealbox(dot)com>, Michael Fuhr <mike(at)fuhr(dot)org>, pgsql-novice(at)postgresql(dot)org |
| Subject: | Re: help with query: advanced ORDER BY... |
| Date: | 2006-01-15 18:33:48 |
| Message-ID: | 20060115101603.P57128@megazone.bigpanda.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-novice |
On Sun, 15 Jan 2006 me(at)alternize(dot)com wrote:
> > Something you may consider doing is creating a view that masks the
> > screen_number in those cases, something like
> >
> > create view schedule_public_view as
> > select theater_id
> > , screen_date
> > , screen_time
> > , case when no_screen_number then 0 else screen_number end as
> > screen_number
> > , movie_name
> > from schedules;
>
> wouldn't this be the same problem: pgsql not using the index for
> screen_number anymore?
Theoretically an expressional index with the case expression should be
usable for sorting with more complicated expressions like that. That
really only an option if theres a small number of fixed orders though (and
in testing it looked like you might need to play with settings to get it
chosen).
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andreas Kretschmer | 2006-01-15 18:49:39 | Re: Help with query |
| Previous Message | Christian Hofmann | 2006-01-15 18:19:04 | Help with query |