At 11:22 -0500 11/1/04, Paul DuBois wrote:
At 12:46 -0300 11/1/04, Ronan Lucio wrote:
 > What is "the correct result"?

The correct result is the data in the updated column after commit.

For example, if I have:

Table1
=====
- id
- name

INSERT INTO Table1 (id, name) VALUES (1, 'AAA')

UPDATE LOW PRIORITY Table1
SET name = 'BBB'

SELECT name
FROM Table1

Will it return BBB?

It depends.

After the INSERT, name is 'AAA'.

When the UPDATE is issued, if no other client is reading from the
table, the UPDATE executes and changes name to 'BBB'.  Then the SELECT
also returns 'BBB'.  (The distinction that you draw in another message
between "on disk" and "in the cache" is irrelevant.)

If some other client happens to be reading from the table, the UPDATE
blocks until no client is reading and then executes.
Then the SELECT also returns 'BBB', as above.


Now, this result depends on the UPDATE and the SELECT being issued by the same time. If one client issues the UPDATE and another issues the SELECT, it's perfectly posssible for the SELECT to return 'AAA'.


Sorry, mistake in the preceding para:

"issued by the same time" -> "issued by the same client".

--
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to