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