Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-performance by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group