title: What's more efficient? Read and Write If... or always write to db?
body: <p>I have a database table, that has a column, which is being updated frequently (relatively).</p>
  
  <p>The question is:</p>
  
  <p>Is it more efficient to avoid always writing to the database, by reading the object first (<code>SELECT ... WHERE</code>), and comparing the values, to determine if an update is even necessary</p>
  
  <p>or always just issue an update (<code>UPDATE ... WHERE</code>) without checking what's the current state.</p>
  
  <p>I think that the first approach would be more hassle, as it consists of two DB operations, instead of just one, but we could also avoid an unnecessary write.</p>
  
  <p>I also question if we should even think about this, as our db will most likely not reach the 100k records in this table anytime soon, so even if the update would be more costly, it wouldn't be an issue, but please correct me if I'm wrong.</p>
  
  <p>The database is PostgreSQL 9.6 </p>