On 02/03/2010 05:24 PM, Jonathan Vanasco wrote:
> I use PostgreSQL exclusively too, and rely on tons of constraints
> within the db - from unique indexes built through functions, to actual
> functions themselves.
>
> I still, pretty much, always query the db to check for a duplicate
> value or possible constraint violation.
> 1- It's easier than parsing errors.  plus you don't have to
> continually flush() or save() to trap the error.
> 2- There's really not much of a performance hit on any site i've ever
> worked on.
>   

But if you have the constraints, you're doing the checks twice. First
from your application, and then the db engine does it anyways since
there are constraints. Perhaps you don't have a performance hit, but I
can assure you, if you had a (highly) concurrent system and lots of rows
to check and lock through (because you need SELECT ... FOR UPDATE;
alternatively just lock the entire table) the performance hit would
become significant and visible.



Vlad

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to