If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > LARGE database

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-02-05, 00:05
swati_2004 swati_2004 is offline
Registered User
 
Join Date: Mar 2005
Posts: 1
LARGE database

Hi,
I am working with mysql.There are around 9 lack records in one table (invoice)and 50,000 records (custdata)in the other table.Big table has 8 fields and other has 4 fields.
I want to retrieve those records from invoice whose CUST_NODE _ID matches with CUSTOMER _NODE_ID for a particular record.I am using following query-->

Select a.*from invoice a, custdata b where b.ACCOUNT_ID = '20276783' and b.CUSTOMER_NODE_ID=a.CUST_NB.

As soon as i run this query my database hangs.Can you suggest whats wrong?and how can i optimise i.e reduce select query executition time?

Hope to hear soon from you.

Regards,
Swati
Reply With Quote
  #2 (permalink)  
Old 03-02-05, 05:56
r937 r937 is online now
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
make sure that each of the three columns mentioned in your query has an index defined on it (but do not declare an index on a column that is already defined as a primary key)
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On