Re: its really SLOW!!!!!

From: "Michael Paesold" <mpaesold(at)gmx(dot)at>
To: "Adler, Stephen" <adler(at)bnl(dot)gov>, "Joel Burton" <joel(at)joelburton(dot)com>
Cc: <pgsql-novice(at)postgresql(dot)org>
Subject: Re: its really SLOW!!!!!
Date: 2002-12-03 08:09:34
Message-ID: 003701c29aa3$51e87210$4201a8c0@beeblebrox
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Adler, Stephen <adler(at)bnl(dot)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

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message paul butler 2002-12-03 09:52:48 Re: its really SLOW!!!!!
Previous Message Joel Burton 2002-12-02 22:27:18 Re: its really SLOW!!!!!