Re: its really SLOW!!!!! - Mailing list pgsql-novice

From Michael Paesold
Subject Re: its really SLOW!!!!!
Date
Msg-id 003701c29aa3$51e87210$4201a8c0@beeblebrox
Whole thread Raw
In response to its really SLOW!!!!!  ("Adler, Stephen" <adler@bnl.gov>)
List 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 by date:

Previous
From: Joel Burton
Date:
Subject: Re: its really SLOW!!!!!
Next
From: "paul butler"
Date:
Subject: Re: its really SLOW!!!!!