Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Performance > Re: Performance...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 5 Topic 4008 of 4424
Post > Topic >>

Re: Performance of the Materialize operator in a query plan

by lists@[EMAIL PROTECTED] (PFC) Apr 24, 2008 at 07:05 PM

> Do you mean, that the overhead is an artefact of timing the query? 
In=20=
=20
> that case, the query should run faster than its evaluation with EXPLAIN=
=20=20
> ANALYZE, correct?
>
> Is there a way to test this assumption regarding the speed of=20=20
> gettimeofday?  I'm on a Macbook and have no idea about the
performance=20=
=20
> of its implementation.

Run EXPLAIN ANALYZE query
Type \timing
Run SELECT count(*) FROM (query) AS foo

\timing gives timings as seen by the client. If you're local, and
the=20=20
result set is one single integer, client timings are not very
different=20=
=20
 from server timings. If the client must retrieve lots of rows, this will=
=20=20
be different, hence the fake count(*) above to prevent this. You might=20=
=20
want to explain the count(*) also to be sure the same plan is used...

And yes EXPLAIN ANALYZE has overhead, sometimes significant. Think=20=20
Heisenberg... You will measure it easily with this dumb method ;)


Here a very dumb query :

SELECT count(*) FROM test;
  count
-------
  99999
(1 ligne)

Temps : 26,924 ms


test=3D> EXPLAIN ANALYZE SELECT count(*) FROM test;
                                                    QUERY PLAN
---------------------------------------------------------------------------=
-----=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20
--------------------------------
  Aggregate  (cost=3D1692.99..1693.00 rows=3D1 width=3D0) (actual=20=20
time=3D66.314..66.314=20=20
r=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20
ows=3D1 loops=3D1)
    ->  Seq Scan on test  (cost=3D0.00..1442.99 rows=3D99999 width=3D0)
(ac=
tual=20=20
time=3D0.=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20
013..34.888 rows=3D99999 loops=3D1)
  Total runtime: 66.356 ms
(3 lignes)

Temps : 66,789 ms

Apparently measuring the time it takes to get a row from the table
takes=20=
=20
2x as long as actually getting the row from the table. Which is=20=20
reassuring, in a way, since grabbing rows out of tables isn't such
an=20=20
unusual operation.


--=20
Sent via pgsql-performance mailing list (pgsql-performance@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance
 




 5 Posts in Topic:
Performance of the Materialize operator in a query plan
rosenfel@[EMAIL PROTECTED  2008-04-21 13:07:22 
Re: Performance of the Materialize operator in a query plan
tgl@[EMAIL PROTECTED] (T  2008-04-21 10:44:49 
Re: Performance of the Materialize operator in a query plan
rosenfel@[EMAIL PROTECTED  2008-04-24 16:31:58 
Re: Performance of the Materialize operator in a query plan
lists@[EMAIL PROTECTED]   2008-04-24 19:05:14 
Re: Performance of the Materialize operator in a query plan
rosenfel@[EMAIL PROTECTED  2008-04-27 21:02:19 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Dec 1 8:15:07 CST 2008.