Re: Re: Getting last record ID created from DB

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



markw@xxxxxxxxxxxxxx wrote:
markw@xxxxxxxxxxxxxx wrote:
http://www.postgresql.org/docs/current/static/functions-sequence.html

It is perfectly safe to use this.
In theory that may be true, but can the application developer make any
assumption about the underlying architecture? Might you be familiar with
connection pooling? Where multiple threads or processes share a database
connection or "session?"
If the developers of the database say it's safe, then I'm happy to take
their word on it. If you can prove otherwise, please do so and post a
bug report to them.

This isn't abut the database, per se' but connection pooling between the
Apache/PHP process and the database. I can't tell you how many times I've
seen that burn people.


In this case, tons of people are using connection
pooling with postgres. If a problem had been discovered, then they would
have complained and it would have been fixed.

I periodically participate on the PG hackers list, and if such a bug were
reported, it would be bounced to the connection pool interface guys or
ignored, because, it is essentially out of the control of the PostgreSQL
developers.

Do I need to evaluate every section of code that a 3rd party provides to
make sure the code does what the docs say it should? I'd never get
anything done. At some point I just need to know how to use it and trust
it works as it should. If it's a super critical application (eg
financial information) where integrity is 100% required, then I'd test
it. If I found a problem then I'd complain *shrug*.

You are confusing "PostgreSQL" with the connection pooling interface. I
have seen this issue a few times with PostgreSQL and Oracle.

As Richard mentioned in another reply, the developers (whether it's
mysql or postgres or "other") have taken a lot of pain to make sure
these things work properly.

Again, it isn't about "PostgreSQL," because yes it does work if you go
directly to PG, but if you use an interface that uses connection pooling
to reduce resource usage, you are going to see problems.

Why would I try and do exactly the same thing myself and most likely get
it completely wrong?

Because doing a a good web site, that really works, takes thinking about
it, it takes understanding it, you can't be lazy and "trust" that someone
else has done something, and then forget all the possible layers between
you and it. That is *the* recipe for failure.

If I have to develop a website that handles a huge amount of traffic, of course I'm going to have to understand it all (well try to :P). 99.9% of sites don't and thus don't have to worry about this sort of thing. Until you get to that stage, is there a point in worrying about this sort of stuff?

Maybe I need to get into developing more high traffic websites :P

Going from a single webserver to multiple webservers and/or connection pooling is a big step, and you'd obviously have to test the crap out of your software/hardware before making the change "live".. and then deal with the issues that you discover.

The rest of your rant I agree with in theory, but making something
"flexible" is extremely difficult unless you understand what you're
trying to accomplish from the beginning - and know each system well
enough to know how each one works and the differences between them. Not
even "LIMIT" is standard across databases let alone anything else like
data types ('int(11)' compared to 'int', 'datetime' compared to
'timestamp' etc etc etc) or even date formats that they store.

Taking all of that into account from the very beginning is pretty tough.

If you going to do something, do it right, or else what's the point?
Sometimes it is harder, but that's why being a professional is different.

So open source projects all need to be run & developed by professionals? Your original rant was about open source projects being "lazy" and limiting their thinking & support for different options. Doing a professional project is completely different to anyone starting an open source project.

Most projects start out as 2-3 people developing it and then deciding to make it open source. When that happens, it gradually builds up and more people come on board. I still say it's pretty hard to take everything like this into account when you're starting out.

Anyway this is getting way OT, I guess we'll agree to disagree ;)

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux