Hi,
I am trying to improve search times on a moderately large table (approx 1
GB).
I have noticed that clustering the data improves performance significantly,
but is a bit of a pain especially with dynamic data.
What I would like to do is select data direct from the index and not have to
go back to the table itself each time.
eg, my query is:
SELECT id FROM books WHERE category_key = 1471;
(this takes ages on a table not ordered by category_key even if I have an
index on category_key)
If I created an index:
CREATE INDEX books_category_id ON books(category_key,id);
and then run the above query, it has no need to go to the books table to
retrieve the id, and should be fast. But it appears that it still does
access the books table.
I have tried
SELECT id FROM books_category_id WHERE category_key = 1471;
but you can't select from an index :(
Another option would be to do the clustering using a view, but:
create view books_category as select id,category from books order by
category;
ERROR: Order by and Distinct on views is not implemented.
Does anyone know when this will be implemented?
Has anyone got any better ideas, or shall I just do static clustering once
in a while?
Thanks for any advice.
Cheers
Tim Joyce