I ran the SELECT without the INSERT earlier today and it ran considerably 
faster (at least 4 times), so I didn't think that it would be too bad to insert the 
data.

Would it be faster to combine the two SELECT statements into:

insert into mytab2
select y03m02_Pt.person, y03m02_Acdt.place, y03m02_Acdt.charge_id, y03m02_Acdt.disch,
y03m02_Pt.age, y03m02_Pt.sex, y03m02_Pt.di, y03m02_Pt.dr_id, y03m02_Pt.drty,
y03m02_Acdt.U, y03m02_Acdt.C, y03m02_Acdt.billing_desc
from y03m02_Acdt, y03m02_Acmt, y03m02_Pt
where
(
(
match (billing_desc) against ('search')
AND (U not like "2__")
AND room=0
AND (billing_desc not like "%amplifi%")
AND (billing_desc not like "%PCR%")
AND (billing_desc not like "%western%")
AND C="?????"
)
(
OR C="87903"
)
)
AND y03m02_Pt.person=y03m02_Acmt.person
AND y03m02_Acmt.place=y03m02_Acdt.place
AND y03m02_Acmt.charge_id=y03m02_Acdt.charge_id;






-----Original Message-----
From: Keith C. Ivey [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 26, 2003 5:54 PM
To: [EMAIL PROTECTED]
Cc: Charles Vos
Subject: Re: Speed Up Insert Query Results


On 26 Jun 2003 at 17:45, Charles Vos wrote:

>     Could somebody please enlighten me as to why it takes nearly 2
>     hours to put 8 rows of data into my table?

It's not the INSERT that's taking so long -- it's the SELECT.  Try 
the SELECT alone, and it will probably take the same amount of time.  
Do an EXPLAIN on each of your SELECT queries and compare the use of 
indexes to see why there's such a difference.

-- 
Keith C. Ivey <[EMAIL PROTECTED]>
Tobacco Documents Online
http://tobaccodocuments.org


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to