0

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?

Itsmeromka
  • 3,621
  • 9
  • 46
  • 79

1 Answers1

1

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.

Zafar Malik
  • 6,734
  • 2
  • 19
  • 30