General question about speed of functions
General question about speed of functions
От:
Brent Friedman <brent@brentfriedman.net>
Дата:
I am starting a project next week that looks like it will involve some massive sql rewrites to gain needed performance, and I am looking at implementing as many functions as possible. I haven't worried that much about specific implementations in the past, but this project can use any performance gains available, so even a five percent difference between a function written in c vs pgsql would be helpful. The apparent choices available for the existing application are to use functions in pgsql, php or c. Any comments about relative performance of using any of those languages would be greatly appreciated. Thanks, Brent Friedman -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
Re: General question about speed of functions
От:
<tv@fuzzy.cz>
Дата:
On Tue, 13 Apr 2010 10:26:04 -0400, Brent Friedman wrote: > I am starting a project next week that looks like it will involve some > massive sql rewrites to gain needed performance, and I am looking at > implementing as many functions as possible. I haven't worried that much > about specific implementations in the past, but this project can use any > performance gains available, so even a five percent difference between a > function written in c vs pgsql would be helpful. > > The apparent choices available for the existing application are to use > functions in pgsql, php or c. This greatly depends on the type of processing you're doing. If you perform a CPU intensive data processing (a lot of math applied to the data), the C functions may give you tremendous performance gain. But in most cases the processing consists of calls to the SQL engine and simple processing of the results, so it will be about as fast as C (and much easier to develop and maintain). I have no experience with PL/PHP, but I'd say it will be about as fast as PL/pgSQL ... > Any comments about relative performance of using any of those languages > would be greatly appreciated. My recommendation is "Pay attention to properly design the schema, and don't hesitate to change it during development. Choose one of the languages and stick with. And the money you save (due to development in a single language) invest into better hardware. Tomas