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 Admin > Re: [Fwd: perfo...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 4 Topic 4967 of 5408
Post > Topic >>

Re: [Fwd: performance: view or function?]

by robert@[EMAIL PROTECTED] (Robert Treat) May 8, 2008 at 11:00 AM

On Thursday 08 May 2008 06:16:06 Julius Tuskenis wrote:
> Hello,
>
> I have one question - what is the difference between the view and a
> function returning a data set? I mean the performance. Which is better
> to use? If its the same, I would use functions, because I could use
> other languages not just SQL to get the results I want.
>

If the sql you need to run is simple enough to work as a view, then most
of 
the time a view will be faster.  Generally the cases where functions are 
faster involve some type of complex operation, which you can use code in
the 
function to cut down on processing. This get's less effective if you use
an 
external procedural language, since the overhead of things like plperl or 
plphp is much more than that of plpgsql. Again, if you have some really 
complex operation that these languages make simple, it's often worth the 
tradeoffs. Note that for average use, all of this is pretty minimal
anyway, 
so I'd probably recommend just doing it in whichever way you find most 
comfortable, and worry about optimizing things later if you find it's too 
slow.

-- 
Robert Treat
http://www.omniti.com
Internet Scalability Consulting

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




 4 Posts in Topic:
[Fwd: performance: view or function?]
julius@[EMAIL PROTECTED]   2008-05-08 13:16:06 
Re: [Fwd: performance: view or function?]
robert@[EMAIL PROTECTED]   2008-05-08 11:00:56 
Re: [Fwd: performance: view or function?]
scott.marlowe@[EMAIL PROT  2008-05-08 10:42:43 
Re: [Fwd: performance: view or function?]
giorgio_v@[EMAIL PROTECTE  2008-05-09 08:23:30 

Post A Reply:
  Go here to Signup

AddThis Feed Button


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

Contact
tan12V112 Sat Oct 11 12:14:20 CDT 2008.