Question: I have a performance-related question. Let's say I have a user with first name Michael. Take the following query:

```
UPDATE users
SET first_name = 'Michael'
WHERE users.id = 123

```

Will the query actually execute the update, even though it is being updated to the same value? If so, how do I prevent it from happening?

Answer: 
You could simply add to the `where` clause:

```
UPDATE users
SET first_name = 'Michael'
WHERE users.id = 123
    AND (first_name <> 'Michael' OR first_name IS NULL);

```

If `first_name` is defined as `NOT NULL`, the `OR first_name IS NULL` part can be removed.

The condition: 

```
(first_name <> 'Michael' OR first_name IS NULL)

```

can also be written more elegantly as (in Erwin's answer):

```
first_name IS DISTINCT FROM 'Michael'

```
**From a database point of view**

The answer to your question is YES. The update will take place. The database does not check the previous value, it only sets the new value.

As this happen in memory (and will only be written to the datafiles after a commit is issued) the performance would not be an issue.

**From an ORM perspective**

Normally you will have an Object representing a single row of the database (it can be a lot more complex than that, but let's keep it simple). This object is managed in memory (at the app server level) and only the latest commited version of that object will actually make it to the database at a certain point.

That may explain the different behaviour.

Now, let's not compare a cargo ship with a 3D printer. The fact that you can send 3D printers using cargo ships doesn't mean that there may be any kind of comparison between them.

Enjoy!

I hope this clarified some concepts.