Skip site navigation (1) Skip section navigation (2)

Re: optimizing query

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Chantal Ackermann <chantal(dot)ackermann(at)biomax(dot)de>
Cc: <pgsql-general(at)postgresql(dot)org>,<pgsql-performance(at)postgresql(dot)org>
Subject: Re: optimizing query
Date: 2003-01-22 16:20:15
Message-ID: 20030122081422.Y96911-100000@megazone23.bigpanda.com (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-performance
(Replying to general and performance in a hope to move this
to performance after a couple of replies).

On Wed, 22 Jan 2003, Chantal Ackermann wrote:

> I am getting the following output from EXPLAIN, concerning a query with
> joins. The merge uses index scans but takes too long, in my opinion. The
> query is in fact only a part (subquery) of another one, but it is the
> bottle neck.
>
> As I am quite ignorant in optimizing queries, and I have no idea where
> to find documentation on the net on how to learn optimizing my queries,
> I am posting this here in hope someone will give me either tips how to
> optimize, or where to find some tutorial that could help me get along on
> my own.
>
> dropping the "DISTINCT" has some effect, but I can't really do without.

The first thing is, have you done ANALYZE recently to make sure that the
statistics are correct and what does EXPLAIN ANALYZE give you (that will
run the query and give the estimate and actual).  Also, if you haven't
vacuumed recently, you may want to vacuum full.

How many rows are there on gene, disease and both occurrances tables?
I'd wonder if perhaps using explicit sql join syntax (which postgres uses
to constrain order) to join disease and disease_occurrences_puid before
joining it to the other two would be better or worse in practice.


In response to

Responses

pgsql-performance by date

Next:From: Seth RobertsonDate: 2003-01-22 17:45:24
Subject: Re: Postgres 7.3.1 poor insert/update/search performance
Previous:From: Tom LaneDate: 2003-01-22 16:09:58
Subject: Re: Postgres 7.3.1 poor insert/update/search performance

pgsql-general by date

Next:From: Justin CliftDate: 2003-01-22 16:20:49
Subject: Re: [part 2] How to backup a postgreSQL of 80 GByte ?
Previous:From: Dmitry AlyabyevDate: 2003-01-22 16:09:01
Subject: is 7.1.3 vulnerable ?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group