Re: Performance problems with prepared statements

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Theo Kramer wrote:
Thanks, had missed that, however, I am afraid that I fail to see how
preparing a query using PQprepare() and then executing it using
PQexecPrepared(), is 8 thousand times slower than directly executing
it.,, ( 403386.583ms/50.0ms =  8067 ).

When doing a 'manual' prepare and explain analyze I get the following

rascal=# explain analyze execute cq ('124         ', 8, 366942);
 Total runtime: 3.272 ms

So I suspect that there is something more fundamental here...

OK, so there must be something different between the two scenarios. It can only be one of:
  1. Query
  2. DB Environment (user, locale, settings)
  3. Network environment (server/client/network activity etc)

Are you sure you have the parameter types correct in your long-running query? Try setting log_min_duration_statement=9000 or so to capture long-running queries.

Make sure the user and any custom settings are the same. Compare SHOW ALL for both ways.

You've said elsewhere you've ruled out the network environment, so there's not point worrying about that further.

--
  Richard Huxton
  Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your
      message can get through to the mailing list cleanly

[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux