Re: Confused by 'timing' results

From: Willy-Bas Loos <willybas(at)gmail(dot)com>
To: A J <s5aly(at)yahoo(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org, Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>
Subject: Re: Confused by 'timing' results
Date: 2010-09-01 10:35:58
Message-ID: AANLkTi=NhxV-Y0isfDuQwO_hBDDutDwo-f=N00YdeTzw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

>> time echo '\timing \\select * from  table1 where id = 123;' | psql
>> In the above query. the 'timing' will time the database time and
>> the 'time' command at the very start will time the complete time
>> for the query including network time.
>
> No, the 'timing' will say how long it took to send the query from
> psql to the server and get the complete response back from the
> server.  The 'time' command will also include the time to start
> psql, establish the connection to the database, read from the pipe,
> and close the connection to the database.

if you'd want to get the real execution time for the query from a
faraway client (without network latency), you could open an ssh
session and start psql on the database server.

--
"Patriotism is the conviction that your country is superior to all
others because you were born in it." -- George Bernard Shaw

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Kong Mansatiansin 2010-09-01 19:49:51 Query Optimization with Partitioned Tables
Previous Message Kevin Grittner 2010-08-31 20:35:49 Re: Changing locale to 1250