Which query is faster?

0

Good morning.

I need to make an update to a table (table a) of 50000 records from a table (table b) of 200000 records where I look in table b for all the records that match table a.

I have these two questions:

UPDATE data_0_pagos a
INNER JOIN asgto_datos_ins b ON a.c_cliente = b.c_cliente
SET a.cnt_proc = 1
WHERE
a.c_cliente = b.c_cliente

or

UPDATE data_0_pagos a
INNER JOIN asgto_datos_ins b ON a.c_cliente = b.c_cliente
SET a.cnt_proc = 1

The only thing I change is with the where and without the where .

I make a query where I want to see the records that match in both tables and show me the cliente and the cnt.proc :

SELECT
data_0_pagos.c_cliente,
data_0_pagos.cnt_proc
FROM
data_0_pagos
INNER JOIN asgto_datos_ins ON asgto_datos_ins.c_cliente = data_0_pagos.c_cliente
WHERE
asgto_datos_ins.c_cliente = data_0_pagos.c_cliente

This query takes approximately 10000 seconds, so I would like to know if there is an alternative to make the update faster.

Greetings.

    
asked by Hexen23 26.10.2017 в 23:14
source

0 answers