Domanda

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?

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top