Вопрос

I have simple query

UPDATE `local-cadastre` SET `name` = :district_name WHERE `id` = :uniq_id

But this query is repeated about 24000 times in foreach cycle, it works good but browser displays 504 Gateway Timeout error, is it possible to avoid this?

Это было полезно?

Решение

This problem related with network, due to slow IP communication.

If you do this task by a stored procedure then you can avoid this as stored procedures resides at server end. For it first put all your uniq_ids in a cursor (under stored procedure) then update one by one.

You can call this stored procedure either manually , by event in mysql or windows scheduler or cron job.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top