Skip to content

Commit bce09fd

Browse files
committed
README: document having_clause linter
1 parent 883b1ce commit bce09fd

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Analyses your database queries and schema and suggests indices improvements. You
1313
* reports text columns with character set different than `utf`
1414
* reports queries that do not use indices
1515
* reports queries that use filesort, temporary file or full table scan
16-
* reports queries that are not quite kosher (e.g. `LIKE "%foo%"`, `INSERT IGNORE`, `SELECT *`)
16+
* reports queries that are not quite kosher (e.g. `LIKE "%foo%"`, `INSERT IGNORE`, `SELECT *`, `HAVING` clause)
1717

1818
This tool **supports MySQL 5.5, 5.6, 5.7, 8.0 and MariaDB 10.0, 10.2** and runs under **Python 2.7, 3.4, 3.5 and 3.6**.
1919

@@ -237,6 +237,13 @@ select_star → table affected: bar
237237
238238
- query: SELECT t.* FROM bar AS t;
239239
240+
------------------------------------------------------------
241+
having_clause → table affected: sales
242+
243+
✗ "SELECT s.cust_id,count(s.cust_id) FROM SH.sales s ..." query uses HAVING clause
244+
245+
- query: SELECT s.cust_id,count(s.cust_id) FROM SH.sales s GROUP BY s.cust_id HAVING s.cust_id != '1660' AND s.cust_id != '2'
246+
240247
(...)
241248
242249
------------------------------------------------------------
@@ -280,6 +287,8 @@ Outputs YML file with results and metadata.
280287

281288
## Checks
282289

290+
> **Number of checks**: 17
291+
283292
* `redundant_indices`: reports indices that are redundant and covered by other
284293
* `non_utf_columns`: reports text columns that have characters encoding set to `latin1` (utf is the way to go)
285294
* `missing_primary_index`: reports tables with no primary or unique key (see [MySQL bug #76252](https://bugs.mysql.com/bug.php?id=76252) and [Wikia/app#9863](https://github.com/Wikia/app/pull/9863))
@@ -301,6 +310,7 @@ Outputs YML file with results and metadata.
301310
* `selects_with_like`: reports SELECT queries that use `LIKE '%foo'` conditions (they can not use an index)
302311
* `insert_ignore`: reports [queries using `INSERT IGNORE`](https://medium.com/legacy-systems-diary/things-to-avoid-episode-1-insert-ignore-535b4c24406b)
303312
* `select_star`: reports [queries using `SELECT *`](https://github.com/jarulraj/sqlcheck/blob/master/docs/query/3001.md)
313+
* `having_clause`: reports [queries using `HAVING` clause](https://github.com/jarulraj/sqlcheck/blob/master/docs/query/3012.md)
304314

305315
## Success stories
306316

0 commit comments

Comments
 (0)