1) If the join to rank_lookup is done across Pkey and/or unique
indexed fields and a foreign key is defined for said join, I don't know
how the subquery could possibly be more optimized then it is (the
reasoning being beyond the scope of this discussion and possibly even
beyond the scope of are
On Tue, 2006-05-02 at 14:02 +0200, Martijn van Oosterhout wrote:
> How about:
>
> SELECT id, get_category_text_path(id)
> FROM (SELECT id FROM category
> ORDER BY rank
> LIMIT 5) as x;
Oh that works? Great!
Let me see, with 'rank' from a joined table that looks like:
SELECT id, get_cate
SELECT id, get_category_text_path(id)
FROM category
WHERE id IN (
SELECT c.id
FROM category AS c
ORDER BY c.rank
LIMIT 5
)
Terry Fielder
[EMAIL PROTECTED]
Associate Director Software Development and Deployment
Great Gulf Homes / Ashton Woods Homes
Fax: (416) 441-9085
Markus Schiltknech
Hello Terry,
Thanks a lot. That's so simple I didn't see it. (The original query is
much more complex.)
The only problem is, rank is not a column of category itself, but a
joined row. With this solution, the join will have to be performed
twice. But since this doesn't cost that much and because t
On Tue, May 02, 2006 at 01:37:54PM +0200, Markus Schiltknecht wrote:
> Hi,
>
> when using LIMIT, how do I tell the planner to only call a function for
> rows it returns?
>
> An example: I want to fetch the top five categories. A function
> get_category_text_path(cat_id int) returns the textual re
Markus Schiltknecht wrote:
Hi,
when using LIMIT, how do I tell the planner to only call a function for
rows it returns?
An example: I want to fetch the top five categories. A function
get_category_text_path(cat_id int) returns the textual representation of
the category. For that I do something
Hi,
when using LIMIT, how do I tell the planner to only call a function for
rows it returns?
An example: I want to fetch the top five categories. A function
get_category_text_path(cat_id int) returns the textual representation of
the category. For that I do something like:
SELECT id, get_categor