Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #3845
| From | Robert Klemme <shortcutter@googlemail.com> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: SQL Puzzle - too many dimensions |
| Date | 2011-05-09 01:27 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <3c106267-497c-48a4-bdcb-5b002b3229b7@p13g2000yqh.googlegroups.com> (permalink) |
| References | <tnibs6hnfdp2cav0u74d8heeqsdkvg1c6a@4ax.com> <a0ecs6tjngbukgu3rq539hkfuqbfsfl33r@4ax.com> <7becs6h10lufrqvb8ciii7vpafjqldv3f0@4ax.com> <iq5l3q$pr5$2@lust.ihug.co.nz> |
On 8 Mai, 10:43, Lawrence D'Oliveiro <l...@geek- central.gen.new_zealand> wrote: > In message <7becs6h10lufrqvb8ciii7vpafjqldv...@4ax.com>, Roedy Green wrote: > > > You need to combine these into one query, otherwise the max could > > change just prior to the second query. > > Why does that matter? Because consistency is not guaranteed any more. If the row with the max is removed after the first query, the second query will lack a row for that song_id. More formally, because TX isolation level "read committed" allows for non repeatable reads to occur. If you want to know more please read up on "statement level read consistency". The whole chapter is very informative. http://download.oracle.com/docs/cd/E11882_01/server.112/e16508/consist.htm#CNCPT88960 http://www.postgresql.org/docs/8.4/interactive/transaction-iso.html Also it's usually faster to do it in one query. Cheers robert PS: I advise anybody doing development of applications which persistently store data in _any_ way (yes, this includes infamous "NoSQL" storages) to make themselves familiar with transaction handling. Doing otherwise is grossly negligent and can (and will) cause all sorts of issues from performance degradation to data inconsistency (which is probably worse than data loss). Actually, the concept of "transaction" is not limited to persistent storage but also to how an application deals with its state in memory.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
SQL Puzzle - too many dimensions Zapanaz <http://joecosby.com/code/mail.pl@foo.com> - 2011-05-07 16:13 -0700
Re: SQL Puzzle - too many dimensions Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-05-08 14:00 +1200
Re: SQL Puzzle - too many dimensions Robert Klemme <shortcutter@googlemail.com> - 2011-05-08 13:08 +0200
Re: SQL Puzzle - too many dimensions Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-05-09 00:01 +1200
Re: SQL Puzzle - too many dimensions Lew <noone@lewscanon.com> - 2011-05-08 08:08 -0400
Re: SQL Puzzle - too many dimensions Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-05-08 01:02 -0300
Re: SQL Puzzle - too many dimensions Robert Klemme <shortcutter@googlemail.com> - 2011-05-08 13:03 +0200
Re: SQL Puzzle - too many dimensions Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-05-08 11:14 -0300
Re: SQL Puzzle - too many dimensions Robert Klemme <shortcutter@googlemail.com> - 2011-05-08 23:37 +0200
Re: SQL Puzzle - too many dimensions Zapanaz <http://joecosby.com/code/mail.pl@foo.com> - 2011-05-08 16:06 -0700
Re: SQL Puzzle - too many dimensions Robert Klemme <shortcutter@googlemail.com> - 2011-05-09 22:10 +0200
Re: SQL Puzzle - too many dimensions Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-05-10 13:50 +1200
Re: SQL Puzzle - too many dimensions Robert Klemme <shortcutter@googlemail.com> - 2011-05-10 00:06 -0700
Re: SQL Puzzle - too many dimensions Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-05-13 22:55 +1200
Re: SQL Puzzle - too many dimensions Robert Klemme <shortcutter@googlemail.com> - 2011-05-15 18:52 +0200
Re: SQL Puzzle - too many dimensions Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-05-10 06:35 -0300
Re: SQL Puzzle - too many dimensions Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-05-13 22:57 +1200
Re: SQL Puzzle - too many dimensions Lew <noone@lewscanon.com> - 2011-05-13 07:45 -0400
Re: SQL Puzzle - too many dimensions Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-05-15 13:09 -0300
Re: SQL Puzzle - too many dimensions Robert Klemme <shortcutter@googlemail.com> - 2011-05-15 18:56 +0200
Re: SQL Puzzle - too many dimensions Roedy Green <see_website@mindprod.com.invalid> - 2011-05-07 23:32 -0700
Re: SQL Puzzle - too many dimensions Roedy Green <see_website@mindprod.com.invalid> - 2011-05-07 23:36 -0700
Re: SQL Puzzle - too many dimensions Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-05-08 20:43 +1200
Re: SQL Puzzle - too many dimensions Robert Klemme <shortcutter@googlemail.com> - 2011-05-09 01:27 -0700
Re: SQL Puzzle - too many dimensions Lew <noone@lewscanon.com> - 2011-05-08 07:45 -0400
csiph-web