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 > How can I speed up my SELECTS?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-06-05, 06:33
lazyTrucker lazyTrucker is offline
Registered User
 
Join Date: Dec 2005
Posts: 14
How can I speed up my SELECTS?

Hi all,
I have a search method which needs to get quicker, due to the growing size of users and the db.

The db is in second normal state, however for the initial search no keys are used to match a result, the db will return many results which r then validated.

Once the valid options are returned the indexing comes in to its own and I have no complaints.

But I would be greatful of any suggestions, references or technical docs on how to speed up my initial search.

Cheers LazyTrucker.
Reply With Quote
  #2 (permalink)  
Old 12-06-05, 07:43
felixg felixg is offline
Registered User
 
Join Date: Apr 2005
Location: Lier, Belgium
Posts: 122
Quote:
Originally Posted by lazyTrucker
But I would be greatful of any suggestions, references or technical docs on how to speed up my initial search.
With respect to your query, please post the output of:

1) EXPLAIN SELECT .... \G for the query you want to speed up
2) SHOW CREATE TABLE foo; for all tables involved in the query
3) SHOW INDEX FROM foo \G for all tables involved in the query

--
felix
Reply With Quote
  #3 (permalink)  
Old 12-06-05, 10:24
lazyTrucker lazyTrucker is offline
Registered User
 
Join Date: Dec 2005
Posts: 14
Quote:
Originally Posted by felixg

1) EXPLAIN SELECT .... \G for the query you want to speed up
2) SHOW CREATE TABLE foo; for all tables involved in the query
3) SHOW INDEX FROM foo \G for all tables involved in the query

--
felix
If I was to provide all of the above information it would turn out to be a vry lengthy doc, and I would be breaching my contract as a result.
However I shall break it down if u feel you could still help, so here goes:

Basically this is a train journey and timetable database which has three basic tables in order to find a routing.

table 1: Bolt on (this may be an extra leg in order to make the departure)
table 2: Main (this is where the main journey details are held)
table 3: Bolt on (this may be an extra leg in order to make the arrival)

So the journey may be found 4 different ways.

1:Using only the main (table 2).
2:Using a bolt on (table 1) and the main (table 2).
3:Using the main (table 2) and a bolt on (table 3)
4:Using a bolt on (table 1) the main (table 2) and a bolt on (table 3)

In order to find a journey I search from the arrival back the way, and use 2 search's to do so.

1tarting from the main(table 2) finding the arrival then determining the point of origin.

2tarting from the bolt on(table 3) finding the arrival then determining the point of origin.

So essentially I am only entering one search parameter, the arrival then validating the departure and looping through the records.

I have used joins for this purpose and found the performance dramtically reduced with the excution taking up to 120secs to complete.

I would welcome an alternative method, or ne guidance on how to speed up the processing.
I am familiar with using arrays or the dictionary object to hold the record information but Im not sure if this would suit my purpose, or make much difference as the information is discarded after the life of the record and not re-used.

Cheers again hope this clears things up slightly, LazyTrucker
Reply With Quote
  #4 (permalink)  
Old 12-08-05, 07:51
felixg felixg is offline
Registered User
 
Join Date: Apr 2005
Location: Lier, Belgium
Posts: 122
Quote:
Originally Posted by lazyTrucker
Basically this is a train journey and timetable database which has three basic tables in order to find a routing.

table 1: Bolt on (this may be an extra leg in order to make the departure)
table 2: Main (this is where the main journey details are held)
table 3: Bolt on (this may be an extra leg in order to make the arrival)
Why do you need three tables? Is it not possible to put all data into one timetable?
Quote:
So the journey may be found 4 different ways.

1:Using only the main (table 2).
2:Using a bolt on (table 1) and the main (table 2).
3:Using the main (table 2) and a bolt on (table 3)
4:Using a bolt on (table 1) the main (table 2) and a bolt on (table 3)
Not sure what you mean with "bolt on".

Quote:
I have used joins for this purpose and found the performance dramtically reduced with the excution taking up to 120secs to complete.
Are your tables properly indexed? One way to find out is to look at the output I asked you to post in my previous reply.

Quote:
I would welcome an alternative method, or ne guidance on how to speed up the processing.
Consider hiring a consultant and have him sign an NDA if you are worried about confidentiality.

--
felix
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