How to measure query time - with warm up and cached data

From: Neto pr <netoprbr9(at)gmail(dot)com>
To: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: How to measure query time - with warm up and cached data
Date: 2018-01-21 20:45:54
Message-ID: CA+TZvY+rJWVUZJOXdChCLctxdnTg58rRABeV-WWiCYx=OC37kA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,
I need to know the actual execution time of a query, but considering that
the data is already cached. I also need to make sure that cached data from
other queries is cleared.
I believe that in order to know the real time of a query it will be
necessary to "warm up" the data to be inserted in cache.

Below are the steps suggested by a DBA for me:

Step 1- run ANALYZE on all tables involved before the test;
Step 2- restart the DBMS (to clear the DBMS cache);
Step 3- erase the S.O. cache;
Step 4- execute at least 5 times the same query.

After the actual execution time of the query, it would have to take the
time of the query that is in the "median" among all.

Example:

Execution 1: 07m 58s
Execution 2: 14m 51s
Execution 3: 17m 59s
Execution 4: 17m 55s
Execution 5: 17m 07s

In this case to calculate the median, you must first order each execution
by its time:
Execution 1: 07m 58s
Execution 2: 14m 51s
Execution 5: 17m 07s
Execution 4: 17m 55s
Execution 3: 17m 59s

In this example the median would be execution 5 (17m 07s). Could someone
tell me if this is a good strategy ?
Due to being a scientific work, if anyone has a reference of any article or
book on this subject, it would be very useful.

Best Regards
Neto

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tim Clarke 2018-01-21 20:45:55 Re: Best non-networked front end for postgresql
Previous Message Vincenzo Romano 2018-01-21 19:05:52 Re: Best non-networked front end for postgresql