In MySQL, you can do "explain $query" to see what MySQL estimates will be the workload. Interpreting that output is more art than science, but with practice, you can at least avoid SOME querie that will drive your server to its knees. I did work on a PostgreSQL search engine once where we did a similar thing in the program and just bailed out if the search was clearly going to take far too long. Kind of nifty, really... On Mon, October 9, 2006 3:50 pm, afan@xxxxxxxx wrote: > while I was trying again I did something wrong (?) and my server is > now > "busy" and looks like it went down?!? > > The qestion is how can I check first query before I apply it to be > sure > I'm not goig to read every record in my DB or get into loop? > > thanks. > > -afan > >> On 10/9/06, afan@xxxxxxxx <afan@xxxxxxxx> wrote: >>> but I know there must be much better solution then this one. >> >> You're right: Simply JOIN your queries... >> >> SELECT order_id, order_date, order_status, file_name >> FROM orders >> JOIN uploaded_files AS uf ON orders.order_id = uf.order_id >> ORDER BY orders.order_id DESC >> LIMIT 100 >> >> HTH, >> John W >> >> >>> >>> thanks for any help. >>> >>> -afan >>> >>> -- >>> PHP General Mailing List (http://www.php.net/) >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >>> >> > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php