Query Optimization with Kruskal’s Algorithm - Mailing list pgsql-performance

From Tarcizio Bini
Subject Query Optimization with Kruskal’s Algorithm
Date
Msg-id 461a87490805070928h14226615hb87bf2574e26f330@mail.gmail.com
Whole thread Raw
Responses Re: Query Optimization with Kruskal’s Algorithm  ("Alexander Staubo" <alex@purefiction.net>)
List 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.

pgsql-performance by date:

Previous
From: Dennis Muhlestein
Date:
Subject: Re: Possible Redundancy/Performance Solution
Next
From: "Alexander Staubo"
Date:
Subject: Re: Query Optimization with Kruskal’s Algorithm