Re: order by index, and inheritance

From: Michiel Meeuwissen <Michiel(dot)Meeuwissen(at)omroep(dot)nl>
To: Rod Taylor <pg(at)rbt(dot)ca>
Cc: performance(at)postgresql(dot)org
Subject: Re: order by index, and inheritance
Date: 2004-04-22 11:02:14
Message-ID: 20040422110214.GH6870@michiel.omroep.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Rod Taylor <pg(at)rbt(dot)ca> wrote:
> The scan is picking the best method for grabbing everything within the
> table, since it is not aware that we do not require everything.

Hmm. That is a bit silly. Why does it use the index if select only from
mm_mediasources?

> You can explicitly tell it what you want to do via:
>
> SELECT *
> FROM (SELECT * FROM mm_mediasources ORDER BY number DESC LIMIT 20
> UNION SELECT * FROM <subtable> ORDER BY number DESC LIMIT 20) AS tab
> ORDER BY number DESC LIMIT 20

I think you meant 'only mm_mediasources', and btw order by and limit are not
accepted before union, so the above query does not compile.

I can't figure out any acceptable work-around. Even if something as the
above would work, it still would be hardly elegant, and you can as well have
no support for inheritance (actually, you can _better_ have no inheritance,
because at least it is clear what works then).

Michiel

btw. Why are these messages not appearing on the list itself?

--
Michiel Meeuwissen
Mediapark C101 Hilversum
+31 (0)35 6772979
nl_NL eo_XX en_US
mihxil'
[] ()

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2004-04-22 12:36:28 Re: Wierd context-switching issue on Xeon patch for 7.4.1
Previous Message Tom Lane 2004-04-22 05:13:47 Re: Wierd context-switching issue on Xeon patch for 7.4.1