Skip to content

Commit 743981a

Browse files
committed
neil2
1 parent a792fb5 commit 743981a

File tree

2 files changed

+89
-5
lines changed

2 files changed

+89
-5
lines changed

articles/mysql/flexible-server/concepts-server-parameters.md

Lines changed: 88 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ Creating new client connections to MySQL takes time and once established, these
116116
117117
### innodb_strict_mode
118118

119-
If you receive an error similar to "Row size too large (> 8126)", you may want to turn OFF the parameter **innodb_strict_mode**. The server parameter **innodb_strict_mode** isn't allowed to be modified globally at the server level because if row data size is larger than 8k, the data is truncated without an error, which can lead to potential data loss. We recommend modifying the schema to fit the page size limit.
119+
If you receive an error similar to "Row size too large (> 8126)", you may want to turn OFF the parameter **innodb_strict_mode**. The server parameter **innodb_strict_mode** can't be modified globally at the server level because if row data size is larger than 8k, the data is truncated without an error, which can lead to potential data loss. We recommend modifying the schema to fit the page size limit.
120120

121121
This parameter can be set at a session level using `init_connect`. To set **innodb_strict_mode** at session level, refer to [setting parameter not listed](./how-to-configure-server-parameters-portal.md#setting-non-modifiable-server-parameters).
122122

@@ -131,7 +131,7 @@ Upon initial deployment, an Azure for MySQL Flexible Server includes system tabl
131131

132132
In Azure Database for MySQL this parameter specifies the number of seconds the service waits before purging the binary log file.
133133

134-
The binary log contains “events” that describe database changes such as table creation operations or changes to table data. It also contains events for statements that potentially could have made changes. The binary log is used mainly for two purposes, replication and data recovery operations. Usually, the binary logs are purged as soon as the handle is free from service, backup or the replica set. If there are multiple replicas, the binary logs wait for the slowest replica to read the changes before it's been purged. If you want to persist binary logs for a more duration of time, you can configure the parameter binlog_expire_logs_seconds. If the binlog_expire_logs_seconds is set to 0, which is the default value, it purges as soon as the handle to the binary log is freed. If binlog_expire_logs_seconds > 0, then it would wait until the seconds configured before it purges. For Azure database for MySQL, managed features like backup and read replica purging of binary files are handled internally. When you replicate the data-out from the Azure Database for MySQL service, this parameter needs to be set in primary to avoid purging of binary logs before the replica reads from the changes from the primary. If you set the binlog_expire_logs_seconds to a higher value, then the binary logs won't get purged soon enough and can lead to increase in the storage billing.
134+
The binary log contains “events” that describe database changes such as table creation operations or changes to table data. It also contains events for statements that potentially could have made changes. The binary log is used mainly for two purposes, replication and data recovery operations. Usually, the binary logs are purged as soon as the handle is free from service, backup or the replica set. If there are multiple replicas, the binary logs wait for the slowest replica to read the changes before it's been purged. If you want to persist binary logs for a more duration of time, you can configure the parameter binlog_expire_logs_seconds. If the binlog_expire_logs_seconds is set to 0, which is the default value, it purges as soon as the handle to the binary log is freed. If binlog_expire_logs_seconds > 0, then it would wait until the seconds configured before it purges. For Azure database for MySQL, managed features like backup and read replica purging of binary files are handled internally. When you replicate the data-out from the Azure Database for MySQL service, this parameter needs to be set in primary to avoid purging of binary logs before the replica reads from the changes from the primary. If you set the binlog_expire_logs_seconds to a higher value, then the binary logs won't be purged soon enough and can lead to increase in the storage billing.
135135

136136
### event_scheduler
137137

@@ -193,15 +193,99 @@ To configure the `event_scheduler` server parameter in Azure Database for MySQL,
193193

194194
4. To view the Event Scheduler Details, run the following SQL statement:
195195

196-
```slq
196+
```sql
197197
SHOW EVENTS;
198198
```
199199

200200
The following output appears:
201201

202202
```azurecli
203203
mysql> show events;
204-
+-----+---------------+-------------+-----------+-----------+------------+----------------+----------------+--------------------
204+
+-----+---------------+-------------+-----------+-----------+------------+----------------+----------------+---------------------+---------------------+---------+------------+----------------------+----------------------+--------------------+
205+
| Db | Name | Definer | Time zone | Type | Execute at | Interval value | Interval field | Starts | Ends | Status | Originator | character_set_client | collation_connection | Database Collation |
206+
+-----+---------------+-------------+-----------+-----------+------------+----------------+----------------+---------------------+---------------------+---------+------------+----------------------+----------------------+--------------------+
207+
| db1 | test_event_01 | azureuser@% | SYSTEM | RECURRING | NULL | 1 | MINUTE | 2023-04-05 14:47:04 | 2023-04-05 15:47:04 | ENABLED | 3221153808 | latin1 | latin1_swedish_ci | latin1_swedish_ci |
208+
+-----+---------------+-------------+-----------+-----------+------------+----------------+----------------+---------------------+---------------------+---------+------------+----------------------+----------------------+--------------------+
209+
1 row in set (0.23 sec)
210+
```
211+
212+
5. After few minutes, query the rows from the table to begin viewing the rows inserted every minute as per the `event_scheduler` parameter you configured:
213+
214+
```azurecli
215+
mysql> select * from tab1;
216+
+----+---------------------+-------------+
217+
| id | CreatedAt | CreatedBy |
218+
+----+---------------------+-------------+
219+
| 1 | 2023-04-05 14:47:04 | azureuser@% |
220+
| 2 | 2023-04-05 14:48:04 | azureuser@% |
221+
| 3 | 2023-04-05 14:49:04 | azureuser@% |
222+
| 4 | 2023-04-05 14:50:04 | azureuser@% |
223+
+----+---------------------+-------------+
224+
4 rows in set (0.23 sec)
225+
```
226+
227+
6. After an hour, run a Select statement on the table to view the complete result of the values inserted into table every minute for an hour as the `event_scheduler` is configured in our case.
228+
229+
```azurecli
230+
mysql> select * from tab1;
231+
+----+---------------------+-------------+
232+
| id | CreatedAt | CreatedBy |
233+
+----+---------------------+-------------+
234+
| 1 | 2023-04-05 14:47:04 | azureuser@% |
235+
| 2 | 2023-04-05 14:48:04 | azureuser@% |
236+
| 3 | 2023-04-05 14:49:04 | azureuser@% |
237+
| 4 | 2023-04-05 14:50:04 | azureuser@% |
238+
| 5 | 2023-04-05 14:51:04 | azureuser@% |
239+
| 6 | 2023-04-05 14:52:04 | azureuser@% |
240+
..< 50 lines trimmed to compact output >..
241+
| 56 | 2023-04-05 15:42:04 | azureuser@% |
242+
| 57 | 2023-04-05 15:43:04 | azureuser@% |
243+
| 58 | 2023-04-05 15:44:04 | azureuser@% |
244+
| 59 | 2023-04-05 15:45:04 | azureuser@% |
245+
| 60 | 2023-04-05 15:46:04 | azureuser@% |
246+
| 61 | 2023-04-05 15:47:04 | azureuser@% |
247+
+----+---------------------+-------------+
248+
61 rows in set (0.23 sec)
249+
```
250+
251+
#### Other scenarios
252+
253+
You can set up an event based on the requirements of your specific scenario. A few similar examples of scheduling SQL statements to run at different time intervals follow.
254+
255+
**Run a SQL statement now and repeat one time per day with no end**
256+
257+
```sql
258+
CREATE EVENT <event name>
259+
ON SCHEDULE
260+
EVERY 1 DAY
261+
STARTS (TIMESTAMP(CURRENT_DATE) + INTERVAL 1 DAY + INTERVAL 1 HOUR)
262+
COMMENT 'Comment'
263+
DO
264+
<your statement>;
265+
```
266+
267+
**Run a SQL statement every hour with no end**
268+
269+
```sql
270+
CREATE EVENT <event name>
271+
ON SCHEDULE
272+
EVERY 1 HOUR
273+
COMMENT 'Comment'
274+
DO
275+
<your statement>;
276+
```
277+
278+
**Run a SQL statement every day with no end**
279+
280+
```sql
281+
CREATE EVENT <event name>
282+
ON SCHEDULE
283+
EVERY 1 DAY
284+
STARTS str_to_date( date_format(now(), '%Y%m%d 0200'), '%Y%m%d %H%i' ) + INTERVAL 1 DAY
285+
COMMENT 'Comment'
286+
DO
287+
<your statement>;
288+
```
205289

206290
#### Limitations
207291

articles/mysql/single-server/concepts-server-parameters.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ To configure the `event_scheduler` server parameter in Azure Database for MySQL,
349349

350350
4. To view the Event Scheduler Details, run the following SQL statement:
351351

352-
```slq
352+
```sql
353353
SHOW EVENTS;
354354
```
355355

0 commit comments

Comments
 (0)