Query Optimization with Kruskal’s Algorithm

From: "Tarcizio Bini" <tarcizioab(at)c3sl(dot)ufpr(dot)br>
To: pgsql-performance(at)postgresql(dot)org
Subject: Query Optimization with Kruskal’s Algorithm
Date: 2008-05-07 16:28:04
Message-ID: 461a87490805070928h14226615hb87bf2574e26f330@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hello friends,

I'm working on optimizing queries using the Kruskal algorithm (
http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=4318118). I did several
tests in the database itself and saw interesting results.
I did 10 executions with each query using unchanged source of Postgres and
then adapted to the algorithm of Kruskal.
The query I used is composed of 12 tables and 11 joins.

Results Postgresql unchanged (ms): (\ timing)

170,690
168,214
182,832
166,172
174,466
167,143
167,287
172,891
170,452
165,665
average=> 170,5812 ms

Results of Postgresql with the Kruskal algorithm (ms): (\ timing)

520,590
13,533
8,410
5,162
5,543
4,999
9,871
4,984
5,010
8,883
average=> 58,6985 ms

As you can see the result, using the Kruskal algorithm, the first query
takes more time to return results. This does not occur when using the
original source of Postgres.
So how is the best method to conduct the tests? I take into consideration
the average of 10 executions or just the first one?
Do you think I must clean the cache after each query? (because the other (9)
executions may have information in memory).

regards, Tarcizio Bini.

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message John Smith 2008-05-07 20:02:57 Backup/Restore of single table in multi TB database
Previous Message Dennis Muhlestein 2008-05-07 15:36:55 Re: Possible Redundancy/Performance Solution