pg.ddx.io pgsql-performance@postgresql.org mailing list archive
help / color / mirror / Atom feedSRFs ... no performance penalty?
3+ messages / 2 participants
[nested] [flat]
* SRFs ... no performance penalty?
@ 2003-10-21 00:55 Josh Berkus <josh@agliodbs.com>
0 siblings, 1 reply; 3+ messages in thread
From: Josh Berkus @ 2003-10-21 00:55 UTC (permalink / raw)
To: pgsql-performance
Folks,
I'm working on the demo session for our upcoming presentation at PHPCon.
As a side issue, we ended up comparing 3 versions of the same search screen:
1) All in PHP with views;
2) Using a function to build a query and count results but executing that
query directly and sorting, paging in PHP;
3) Using a Set Returning function to handle row-returning, sorting, and
paging.
All three methods were executing a series moderately complex query against a
medium-sized data set (only about 20,000 rows but it's on a laptop). The
postgresql.conf was tuned like a webserver; e.g. low sort_mem, high
max_connections.
So far, on the average of several searches, we have:
1) 0.19687 seconds
2) 0.20667 seconds
3) 0.20594 seconds
In our tests, using any kind of PL/pgSQL function seems to carry a 0.01 second
penalty over using PHP to build the search query. I'm not sure if this is
comparitive time for string-parsing or something else; the 0.01 seems to be
consistent regardless of scale.
The difference between using a PL/pgSQL function as a query-builder only (the
7.2.x method) and using SRFs was small enough not to be significant.
--
-Josh Berkus
Aglio Database Solutions
San Francisco
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: SRFs ... no performance penalty?
@ 2003-10-21 15:02 Robert Treat <xzilla@users.sourceforge.net>
parent: Josh Berkus <josh@agliodbs.com>
0 siblings, 1 reply; 3+ messages in thread
From: Robert Treat @ 2003-10-21 15:02 UTC (permalink / raw)
To: Josh Berkus <josh@agliodbs.com>; +Cc: pgsql-performance
On Mon, 2003-10-20 at 20:55, Josh Berkus wrote:
> Folks,
>
> I'm working on the demo session for our upcoming presentation at PHPCon.
>
> As a side issue, we ended up comparing 3 versions of the same search screen:
>
> 1) All in PHP with views;
> 2) Using a function to build a query and count results but executing that
> query directly and sorting, paging in PHP;
> 3) Using a Set Returning function to handle row-returning, sorting, and
> paging.
>
> All three methods were executing a series moderately complex query against a
> medium-sized data set (only about 20,000 rows but it's on a laptop). The
> postgresql.conf was tuned like a webserver; e.g. low sort_mem, high
> max_connections.
>
> So far, on the average of several searches, we have:
>
> 1) 0.19687 seconds
> 2) 0.20667 seconds
> 3) 0.20594 seconds
>
Is this measuring time in the back-end or total time of script
execution?
> In our tests, using any kind of PL/pgSQL function seems to carry a 0.01 second
> penalty over using PHP to build the search query. I'm not sure if this is
> comparitive time for string-parsing or something else; the 0.01 seems to be
> consistent regardless of scale.
>
> The difference between using a PL/pgSQL function as a query-builder only (the
> 7.2.x method) and using SRFs was small enough not to be significant.
>
> --
> -Josh Berkus
> Aglio Database Solutions
> San Francisco
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend
Robert Treat
--
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: SRFs ... no performance penalty?
@ 2003-10-21 16:22 Josh Berkus <josh@agliodbs.com>
parent: Robert Treat <xzilla@users.sourceforge.net>
0 siblings, 0 replies; 3+ messages in thread
From: Josh Berkus @ 2003-10-21 16:22 UTC (permalink / raw)
To: Robert Treat <xzilla@users.sourceforge.net>; +Cc: pgsql-performance
Robert,
> > 1) 0.19687 seconds
> > 2) 0.20667 seconds
> > 3) 0.20594 seconds
>
> Is this measuring time in the back-end or total time of script
> execution?
Total time of execution, e.g. from clicking the "enter" button to displaying
the list of matches. Any other comparison would be misleading.
--
Josh Berkus
Aglio Database Solutions
San Francisco
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2003-10-21 16:22 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-10-21 00:55 SRFs ... no performance penalty? Josh Berkus <josh@agliodbs.com>
2003-10-21 15:02 ` Robert Treat <xzilla@users.sourceforge.net>
2003-10-21 16:22 ` Josh Berkus <josh@agliodbs.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox