# Coding Suggestions

Here are suggestions when coding. These are less strict than [coding-guidelines](https://frdocs.socalappsolutions.com/books/dev-note/page/coding-guidelines).

1/ SQL select performance:

- If possible, always specify the list of columns you want to select. For example:

```mysql
$this->connection->select()
    ->from($mainTable, ['id'])
    ->where('ent_type = ?', 'shipment')
    ->columns('id')    // ONLY id is needed
    ->order('id DESC')
    ->limit(1)
```

In the above example; since we only care about the count of rows; we only need to specify columns('id')   
There is a big difference from querying 10 columns versus querying 2 columns.