For SELECT statement (just a reading one, no 'FOR UPDATE'), is COMMIT or ROLLBACK preferred?

2019-08-25 Thread David Wall
Using the latest PostgreSQL, does it matter if my code does a ROLLBACK or a COMMIT on an non-modifying SELECT statement?  My impression is they'd be the same as nothing is changed and therefore there's nothing to commit or rollback, but wondered if there was any difference in how they are proce

Re: For SELECT statement (just a reading one, no 'FOR UPDATE'), is COMMIT or ROLLBACK preferred?

2019-08-25 Thread Rob Sargent
> On Aug 25, 2019, at 1:09 PM, David Wall wrote: > > Using the latest PostgreSQL, does it matter if my code does a ROLLBACK or a > COMMIT on an non-modifying SELECT statement? My impression is they'd be the > same as nothing is changed and therefore there's nothing to commit or > rollback,

Re: For SELECT statement (just a reading one, no 'FOR UPDATE'), is COMMIT or ROLLBACK preferred?

2019-08-25 Thread David Wall
On 8/25/19 12:40 PM, Rob Sargent wrote On Aug 25, 2019, at 1:09 PM, David Wall wrote: Using the latest PostgreSQL, does it matter if my code does a ROLLBACK or a COMMIT on an non-modifying SELECT statement? My impression is they'd be the same as nothing is changed and therefore there's nothi

Re: For SELECT statement (just a reading one, no 'FOR UPDATE'), is COMMIT or ROLLBACK preferred?

2019-08-25 Thread Tom Lane
David Wall writes: > ... So we're trying to determine > if there's actually any difference between commit/rollback after SELECT > statements (with rows returned or not), a bit like if there's any > difference for an UPDATE statement that returns zero rows were updated. They're different code p

Re: For SELECT statement (just a reading one, no 'FOR UPDATE'), is COMMIT or ROLLBACK preferred?

2019-08-26 Thread Luca Ferrari
On Sun, Aug 25, 2019 at 10:12 PM David Wall wrote: > The main issue is that if > we do a SELECT and get a ResultSet that has no rows, if we do a commit > or a rollback, it seems reasonable that these are identical as no > changes were made. My inclination is to do a Connection.commit() on the > c