Unix Technical Forum

Concept about stored procedures

This is a discussion on Concept about stored procedures within the Pgsql General forums, part of the PostgreSQL category; --> Hi, I'm developing one application using this wonderful Database, and I've like of use the concepts correctly. Then, i ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-09-2008, 08:50 AM
Marcos
 
Posts: n/a
Default Concept about stored procedures

Hi,

I'm developing one application using this wonderful Database, and I've
like of use the concepts correctly.

Then, i decided that all my SQL statements will be in database using the
procedure language (plpgsql or plpython), I go create functions for all
interactions in database, and use in the my application the SELECT for
call him.

Is its the correct way of working? Or the correct way is create
procedure functions for big and complex statements?

The application will work with a large Database and will have many
simultaneous access.

Very Thanks!!!!


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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-09-2008, 08:51 AM
Jim C. Nasby
 
Posts: n/a
Default Re: Concept about stored procedures

Using stored procedures as an API to the database is a perfectly
acceptable way of doing things, and provides some nice benefits:

You can lock out all other access to tables. This limits what can be
done if the application gets compromised.

It means you don't have to worry about people embedding SQL into the
bowels of the application.

It provides a well-defined API into the database.

As an added bonus, in 8.1 there is syntax checking done on
functions when they are created. This makes catching bugs much easier...
previously you'd have to actually run the code to see if there were any
syntax errors. Now, if you use functions, syntax errors will be found as
soon as you load the code into the database. This feature alone makes
using stored procs as an API worth it.

On Wed, Jan 11, 2006 at 05:13:01PM +0000, Marcos wrote:
> Hi,
>
> I'm developing one application using this wonderful Database, and I've
> like of use the concepts correctly.
>
> Then, i decided that all my SQL statements will be in database using the
> procedure language (plpgsql or plpython), I go create functions for all
> interactions in database, and use in the my application the SELECT for
> call him.
>
> Is its the correct way of working? Or the correct way is create
> procedure functions for big and complex statements?
>
> The application will work with a large Database and will have many
> simultaneous access.
>
> Very Thanks!!!!
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>


--
Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:59 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com