Jump to content


Photo

Long SQL Queries


  • Please log in to reply
2 replies to this topic

#1 neugi

neugi
  • Members
  • PipPipPip
  • Advanced Member
  • 63 posts

Posted 05 May 2006 - 01:06 PM

Hi,

i got a sql query that takes about 350 sec.

my problem ist that after 60 sec my php script is sending again the same sql query again. also my PHP skript ist getting a Read Timeout. i used this function to extend the time, but it seems they dont work
@set_time_limit(400);
if (function_exists('apache_reset_timeout'))
apache_reset_timeout();

how can i stop this? or what is the best way to execute sql queries that take longer?

best

#2 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 05 May 2006 - 02:24 PM

May I ask what is taking so long? What are you possibly doing that would take 6 minutes to process on the database?

And are you starting the sending of the script every 60 seconds? You really need to change the execution time in the php.ini file.

Info: PHP Manual


#3 neugi

neugi
  • Members
  • PipPipPip
  • Advanced Member
  • 63 posts

Posted 08 May 2006 - 06:45 AM

Hi,

here is the query

INSERT INTO kompa(kompa.prod_id, kompa.model, kompa.typ_id, kompa.model_id, kompa.kompa_flag, kompa.engine_id, kompa.prod)
SELECT MODELS.PROD_ID, MODELS.NAME, MODELS.TYP_ID, MODELSKOMPA.MODEL_ID, MODELSKOMPA.KOMPA_FLAG, MODELS.ENGINE_ID, PRODUCER.NAME
FROM MODELSKOMPA, MODELS, PRODUCER
WHERE MODELS.MODEL_ID = MODELSKOMPA.MODEL_ID AND MODELS.PROD_ID = PRODUCER.PROD_ID
ORDER  BY MODELSKOMPA.MODEL_ID


MODELSKOMPA -> about 17.000 entries
MODELS -> about 17.00 entries
PRODUCER -> 600 entries

OUTPUT is simple all the data is put into a new database form which i will work on

best




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users