readme
parent
7076636a5f
commit
889ee979bf
132
README.md
132
README.md
|
@ -27,26 +27,114 @@ php artisan migrate:fresh --seed
|
||||||
|
|
||||||
# Result
|
# Result
|
||||||
|
|
||||||
| Transactions | Method | time seconds |
|
### Grupo 1:
|
||||||
|-------------:|-------------------|---------------:|
|
|
||||||
| 1000 | UpdateMassive1Job | 1,00s |
|
|
||||||
| 1000 | UpdateMassive2Job | 0,01s |
|
|
||||||
| 1000 | UpdateMassive3Job | 1,00s |
|
|
||||||
| 1000 | UpdateMassive4Job | 0,08s |
|
|
||||||
| 1000 | UpdateMassive5Job | 0,06s |
|
|
||||||
| 10000 | UpdateMassive1Job | 14,00s |
|
|
||||||
| 10000 | UpdateMassive2Job | 0,14s |
|
|
||||||
| 10000 | UpdateMassive3Job | 14,00s |
|
|
||||||
| 10000 | UpdateMassive4Job | 0,73s |
|
|
||||||
| 10000 | UpdateMassive5Job | 0,59s |
|
|
||||||
| 100000 | UpdateMassive1Job | (2m) 156,00s |
|
|
||||||
| 100000 | UpdateMassive2Job | 1,00s |
|
|
||||||
| 100000 | UpdateMassive3Job | (2m) 164,00s |
|
|
||||||
| 100000 | UpdateMassive4Job | 8,00s |
|
|
||||||
| 100000 | UpdateMassive5Job | 7,00s |
|
|
||||||
| 1000000 | UpdateMassive1Job | (26m) 1570,00s |
|
|
||||||
| 1000000 | UpdateMassive2Job | 15,00s |
|
|
||||||
| 1000000 | UpdateMassive3Job | (27m) 1630,00s |
|
|
||||||
| 1000000 | UpdateMassive4Job | (1m) 75,00s |
|
|
||||||
| 1000000 | UpdateMassive5Job | 58,00s |
|
|
||||||
|
|
||||||
|
Atualizar um campo ou mais, mas o valor é o `mesmo` para um determinado grupo:
|
||||||
|
|
||||||
|
`Update1Job`
|
||||||
|
|
||||||
|
```sql
|
||||||
|
update transactions
|
||||||
|
set date=now(),
|
||||||
|
value=1
|
||||||
|
where id = 1;
|
||||||
|
|
||||||
|
update transactions
|
||||||
|
set date=now(),
|
||||||
|
value=1
|
||||||
|
where id = 2;
|
||||||
|
|
||||||
|
update transactions
|
||||||
|
set date=now(),
|
||||||
|
value=1
|
||||||
|
where id = 3;
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
`Update2Job`
|
||||||
|
|
||||||
|
```sql
|
||||||
|
update transactions
|
||||||
|
set date=now(),
|
||||||
|
value=1
|
||||||
|
where id in (1, 2, 3, . . .);
|
||||||
|
```
|
||||||
|
|
||||||
|
| quantity | method | time seconds |
|
||||||
|
|----------:|-------------------|-------------------:|
|
||||||
|
| 1.000 | UpdateMassive1Job | 1,00s |
|
||||||
|
| 1.000 | UpdateMassive2Job | 0,01s |
|
||||||
|
| 10.000 | UpdateMassive1Job | 14,00s |
|
||||||
|
| 10.000 | UpdateMassive2Job | 0,14s |
|
||||||
|
| 100.000 | UpdateMassive1Job | (2m 36s) 156,00s |
|
||||||
|
| 100.000 | UpdateMassive2Job | 1,00s |
|
||||||
|
| 1.000.000 | UpdateMassive1Job | (26m 10s) 1570,00s |
|
||||||
|
| 1.000.000 | UpdateMassive2Job | 15,00s |
|
||||||
|
|
||||||
|
### Grupo 2:
|
||||||
|
|
||||||
|
Atualizar um campo ou mais, mas o valor é o `diferente` para um determinado grupo:
|
||||||
|
|
||||||
|
`Update3Job`
|
||||||
|
|
||||||
|
```sql
|
||||||
|
update transactions
|
||||||
|
set date='2023-04-01',
|
||||||
|
value=10
|
||||||
|
where id = 1;
|
||||||
|
|
||||||
|
update transactions
|
||||||
|
set date='2023-04-02',
|
||||||
|
value=20
|
||||||
|
where id = 2;
|
||||||
|
|
||||||
|
update transactions
|
||||||
|
set date='2023-04-03',
|
||||||
|
value=30
|
||||||
|
where id = 3;
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
`Update4Job`
|
||||||
|
|
||||||
|
```sql
|
||||||
|
update transactions
|
||||||
|
set date= case id when 1 then '2023-04-01'::date
|
||||||
|
when 2 then '2023-04-02'::date
|
||||||
|
when 3 then '2023-04-03'::date
|
||||||
|
end
|
||||||
|
,
|
||||||
|
value=case id when 1 then 10
|
||||||
|
when 2 then 20
|
||||||
|
when 3 then 30
|
||||||
|
end
|
||||||
|
where id in (1, 2, 3);
|
||||||
|
```
|
||||||
|
|
||||||
|
`Update5Job`
|
||||||
|
|
||||||
|
```sql
|
||||||
|
update transactions as t
|
||||||
|
set date = v.date,
|
||||||
|
value = v.value from (
|
||||||
|
values (1, '2023-04-01'::date, 10),
|
||||||
|
(2, '2023-04-02'::date, 20),
|
||||||
|
(3, '2023-04-03'::date, 30)
|
||||||
|
) as v(id, date, value)
|
||||||
|
where t.id = v.id;
|
||||||
|
```
|
||||||
|
|
||||||
|
| quantity | method | time seconds |
|
||||||
|
|----------:|-------------------|-------------------:|
|
||||||
|
| 1.000 | UpdateMassive3Job | 1,00s |
|
||||||
|
| 1.000 | UpdateMassive4Job | 0,08s |
|
||||||
|
| 1.000 | UpdateMassive5Job | 0,06s |
|
||||||
|
| 10.000 | UpdateMassive3Job | 14,00s |
|
||||||
|
| 10.000 | UpdateMassive4Job | 0,73s |
|
||||||
|
| 10.000 | UpdateMassive5Job | 0,59s |
|
||||||
|
| 100.000 | UpdateMassive3Job | (2m 44s) 164,00s |
|
||||||
|
| 100.000 | UpdateMassive4Job | 8,00s |
|
||||||
|
| 100.000 | UpdateMassive5Job | 7,00s |
|
||||||
|
| 1.000.000 | UpdateMassive3Job | (27m 10s) 1630,00s |
|
||||||
|
| 1.000.000 | UpdateMassive4Job | (1m 15s) 75,00s |
|
||||||
|
| 1.000.000 | UpdateMassive5Job | 58,00s |
|
||||||
|
|
Loading…
Reference in New Issue