Re: its really SLOW!!!!!

Поиск
Список
Период
Сортировка
От Michael Paesold
Тема Re: its really SLOW!!!!!
Дата
Msg-id 003701c29aa3$51e87210$4201a8c0@beeblebrox
обсуждение исходный текст
Ответ на its really SLOW!!!!!  ("Adler, Stephen" <adler@bnl.gov>)
Список pgsql-novice
Adler, Stephen <adler@bnl.gov> wrote:

> create master (
>    masterindex integer not null primary key
> );
>
> create magnet (
>    masterindex integer,
>    current integer,
>    voltage integer
> );

Just some thoughts:
First I would create an index on magnet.masterindex. (Indexes
are automatically created only on the primary key.)

CREATE INDEX idx_magnet_masterindex ON magnet (masterindex);

After loading all your data, don't forget to analyze the tables.

VACUUM ANALYZE;
or
ANALYZE <tablename>;
for each table.

> select * from magnet where masterindex=1;
> select * from magnet where masterindex=2;

These two queries will do a complete table scan because of the
lack of an index. See EXPLAIN in the manuals for details about
looking at query plans.
EXPLAIN select * from magnet where masterindex=1;

If the data set changes a lot it could be wise to cluster the
tables once in a while.

What exactly do you want to get out of the data set?

Best Regards,
Michael Paesold


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

Предыдущее
От: Joel Burton
Дата:
Сообщение: Re: its really SLOW!!!!!
Следующее
От: "paul butler"
Дата:
Сообщение: Re: its really SLOW!!!!!