In postgresql by the way, every delete, insert, or update IS a transaction on it's own if you don't wrap it up in a larger one.
That's why it can be so slow if you do this:
for ($i=0;$<1000;$i++){
pg_exec($conn,"insert into...");
}
but using transactions can speed things up quite a bit. Adding begin end pairs to it like this:
pg_exec($conn,"begin");
for (....) {
pg_exec($conn,"insert...");
}
pg_exec($conn,"end");
makes it much faster.
Pretty much any time I'm changing more than one thing in a database I put it into a transaction for speed and reliability.
Transactions also let you do things like update all the records in a table at once, and then have all the changes show up at the same time so the user never sees incoherent data.