Jump to content

how to optimize queries in general?


Alien

Recommended Posts

I\'m curious how people optimize their select statements if they are complex. MySQL 4.0 doesn\'t support nested queries(4.1 supports, but it is an alpha version), so many complex queries have to be broken down with some iterations in php scripts.

 

At the beginning I wrote a nested query and thought that it worked, after I ran it...I remembered that it was not a PostgreSQL DB....so I broke down the query into 3 queries with 2 loops.

 

However, the tables are too big(one has 200,000 rows, another has 20,000 rows, the last one has 6,000 rows), so the process takes about 2 hrs to complete on a LAN.

 

I just want to know, in general, how can I optimize select statements?

Link to comment
Share on other sites

 

yea...indexing will help...but for each insert/delete, I have to pay for it since the index tree changes everytime I insert/delete. I am not sure whether it is worth...I will check with my database schema. Thanks.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.