Frederick, What exactly are you trying to accomplish? Personally, I don't recommend using union unless absolutely necessary, since most people don't really understand when it should be used. And I think it shouldn't be used in this case either.
Select A.id, A.parent, B.id, B.parent from art A inner join art B using (id) order by A.date; See if that gives you the same results as the original query and then explain it to see if you get anything differently. Also what is the table structure including indexes of the table? Donny > -----Original Message----- > From: Fredrik Carlsson [mailto:[EMAIL PROTECTED] > Sent: Sunday, January 02, 2005 5:18 AM > To: Donny Simonton > Cc: mysql@lists.mysql.com > Subject: Re: Max connections being used every 10-12 day. > > It is a single PIII 500MHz, so i just changed thread_concurrency to 2 > :), thanks > > The slow query log don't show that many slow queries, but they did show > alot of queries that was'nt using any index, can these queries cause > some kind of occasional lock up? > > Is there a faster way to perform this query? > (SELECT id,parent FROM art WHERE id=495098 ORDER BY date) UNION > (SELECT id,parent FROM art WHERE > parent=495098 ORDER BY date); > > explain show the following > > +------------+-------+----------------------+---------+---------+-------+- > -----+-----------------------------+ > | table | type | possible_keys | key | key_len | ref > | rows | Extra | > +------------+-------+----------------------+---------+---------+-------+- > -----+-----------------------------+ > | art | const | PRIMARY,id,id_2,id_3 | PRIMARY | 4 | const | 1 > | | > | art | ref | parent | parent | 5 | const | 2 > | Using where; Using filesort | > +------------+-------+----------------------+---------+---------+-------+- > -----+-----------------------------+ > > // Fredrik Carlsson > > Donny Simonton wrote: > > >What kind of box is this? According to you're my.cnf it looks like it's > a > >either a dual with hyperthreading or a quad box. > > > >I don't see that you have your slow query log turned on, this should be > the > >first thing you should do in my opinion. This is what mine looks like. > > > >### Slow Query Information ### > >log-long-format > >log-slow-queries > >log-queries-not-using-indexes > >set-variable = long_query_time=3 > > > >Then go in and fix all of those that are showing up in the slow query > log. > > > >With 4-5 queries per second, you should NEVER fill up the 200 connections > >unless you just have some awful queries or you have some tables that are > >getting corrupted and are being repaired during that time. > > > >Donny > > > > > > > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: > http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]