rules - optimizing

Поиск
Список
Период
Сортировка
От Marcin Grondecki
Тема rules - optimizing
Дата
Msg-id 3.0.6.32.19981216160447.007a6e10@mtl.pl
обсуждение исходный текст
Список pgsql-general
Hi ppl
I've started to use rules. Something strange with one of them:
AIX 4.1
PostgreSQL 6.4

create word_list (id int4, word char(15), count int4 default 0);
CREATE
create unique index word_list_word_uidx on word_list (word);
CREATE
...
(something inserted into word_list)

create table temp (word char(15));
CREATE
create rule ins_word as on insert to temp do instead update word_list set
count=count+1 where word=new.word;
CREATE

I'd like to use "temp" relation as some kind of filter; now i could f.e.
import big chunk of
data from text file (import word) with simple "copy", and this should count
words in file
storing results in word_list.count.
And it works, but...

explain update word_list set count=count+1 where word='aix';
shows index scan (using word_list_word_uidx of course)

but
explain insert into temp (word) values ('aix');
gives seq scan as result.

Relation word_list has about 300 000 tuples, so it's rather boring to w8 1
or 2 s to insert ONE word.

Could i do smth to enforce index scan when using above rule?
BTW. sorry for my english :(


Marcin Grondecki
ojciec@mtl.pl

***** I'm not a complete idiot, some parts are missing...


В списке pgsql-general по дате отправления:

Предыдущее
От: Oleg Broytmann
Дата:
Сообщение: Re: [GENERAL] Date & Datetime problems
Следующее
От: "Albert Chen"
Дата:
Сообщение: Why PostgreSQL is better than other commerial softwares?