insert read
parent
0f693de931
commit
21f8ca50d9
63
README.md
63
README.md
|
@ -25,7 +25,68 @@ run migrate;
|
||||||
php artisan migrate:fresh --seed
|
php artisan migrate:fresh --seed
|
||||||
```
|
```
|
||||||
|
|
||||||
# Result
|
# Insert
|
||||||
|
|
||||||
|
Inserir um registro por vez.
|
||||||
|
|
||||||
|
`Insert1`
|
||||||
|
|
||||||
|
```sql
|
||||||
|
insert into transactions (id, value, date)
|
||||||
|
values (1, 10, '2023-04-01');
|
||||||
|
|
||||||
|
insert into transactions (id, value, date)
|
||||||
|
values (2, 20, '2023-04-02');
|
||||||
|
|
||||||
|
insert into transactions (id, value, date)
|
||||||
|
values (3, 30, '2023-04-03');
|
||||||
|
```
|
||||||
|
|
||||||
|
`Insert2`
|
||||||
|
|
||||||
|
```sql
|
||||||
|
insert into transactions (id, value, date)
|
||||||
|
values (1, 10, '2023-04-01'),
|
||||||
|
(2, 20, '2023-04-02'),
|
||||||
|
(3, 30, '2023-04-03'), ....;
|
||||||
|
```
|
||||||
|
|
||||||
|
> Nesse modelo, a quantidade de parametros acaba estourando, limitando dessa forma a quantidade máxima que pode ser
|
||||||
|
> inserido:
|
||||||
|
>
|
||||||
|
> SQLSTATE[HY000]: General error: 7 number of parameters must be between 0 and 65535
|
||||||
|
|
||||||
|
|
||||||
|
`Insert3`
|
||||||
|
|
||||||
|
```sql
|
||||||
|
insert into transactions (id, value, date)
|
||||||
|
values (1, 10, '2023-04-01'),
|
||||||
|
(2, 20, '2023-04-02'),
|
||||||
|
(3, 30, '2023-04-03'), ....; --limit 1.000
|
||||||
|
|
||||||
|
insert into transactions (id, value, date)
|
||||||
|
values (1001, 50, '2023-04-01'),
|
||||||
|
(1002, 60, '2023-04-02'),
|
||||||
|
(1003, 70, '2023-04-03'), ....; --limit 1.000
|
||||||
|
```
|
||||||
|
|
||||||
|
| quantity | method | time seconds | performance |
|
||||||
|
|----------:|---------|-----------------:|------------:|
|
||||||
|
| 1.000 | Insert1 | 1,44s | - |
|
||||||
|
| 1.000 | Insert2 | 0,09s | - |
|
||||||
|
| 1.000 | Insert3 | 0,09s | - |
|
||||||
|
| 10.000 | Insert1 | 14,25s | - |
|
||||||
|
| 10.000 | Insert2 | 0,88s | - |
|
||||||
|
| 10.000 | Insert3 | 0,83s | - |
|
||||||
|
| 100.000 | Insert1 | (2m 38s) 158,41s | - |
|
||||||
|
| 100.000 | Insert2 | `error` | - |
|
||||||
|
| 100.000 | Insert3 | 8,25s | - |
|
||||||
|
| 1.000.000 | Insert1 | - | - |
|
||||||
|
| 1.000.000 | Insert2 | `error` | - |
|
||||||
|
| 1.000.000 | Insert3 | (1m 35s) 95s | - |
|
||||||
|
|
||||||
|
# Update
|
||||||
|
|
||||||
### Grupo 1:
|
### Grupo 1:
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue