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 > very very slow

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-09-09, 04:58
itman220 itman220 is offline
Registered User
 
Join Date: Sep 2009
Posts: 2
very very slow

Hi

I've a database contains around 100 tables with the same structure. when opening these through a view the performance is extremely slow. it takes more than 12 minutes to open the first 1000 records even on a local pc.

Any suggestions.


BR
Reply With Quote
  #2 (permalink)  
Old 09-09-09, 05:16
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
If the tables have the same structure, can you tell us what the difference between them is? i.e. why can't you have one bigger table?
__________________
George
Twitter | Blog
Reply With Quote
  #3 (permalink)  
Old 09-09-09, 05:21
mike_bike_kite mike_bike_kite is offline
vaguely human
 
Join Date: Jun 2007
Location: London
Posts: 2,519
If the tables have the same structure then they should just be one table. You can add a type field to say what table they might of gone into. You can see for yourself why MySQL is acting slow with your design: first find a particular word in a single large dictionary (shouldn't take you too long), then find the same word in 100 small dictionaries (takes much longer).

Obviously I don't know what's in your tables but the fact you have a 100 of them all with similar data suggests the design is wrong.

EDIT: sorry george - you must of replied while I was typing.

Last edited by mike_bike_kite; 09-09-09 at 05:42.
Reply With Quote
  #4 (permalink)  
Old 09-09-09, 19:42
jpcola jpcola is offline
Registered User
 
Join Date: Jun 2009
Posts: 5
I recently did some evaluated the difference between a relational model vs. a network model database. I have found that a network model actually has less overhead and takes less IO to perform the same actions than a relational database like MySQL.
Reply With Quote
  #5 (permalink)  
Old 09-09-09, 23:47
mnirwan mnirwan is offline
Registered User
 
Join Date: Sep 2009
Posts: 64
You may want to try merge table instead of using view.

See MySQL :: MySQL 5.0 Reference Manual :: 13.3 The MERGE Storage Engine
Reply With Quote
  #6 (permalink)  
Old 09-10-09, 02:28
itman220 itman220 is offline
Registered User
 
Join Date: Sep 2009
Posts: 2
This is a large billing system. The application holds data based on year and month. and the user may query all data based also on date.
Reply With Quote
  #7 (permalink)  
Old 09-11-09, 06:27
mike_bike_kite mike_bike_kite is offline
vaguely human
 
Join Date: Jun 2007
Location: London
Posts: 2,519
Quote:
Originally Posted by itman220
This is a large billing system. The application holds data based on year and month. and the user may query all data based also on date.
If the data in the tables is simply split by year and month then you could work out what tables you need to access by the the date range required ie if looking at month to date data then just build your query on the current table. Needless to say this type of database design is very poor and will cause lot's of issues. Is there a particular reason you can't put the data into one table?
Reply With Quote
  #8 (permalink)  
Old 09-11-09, 08:28
mnirwan mnirwan is offline
Registered User
 
Join Date: Sep 2009
Posts: 64
Quote:
This is a large billing system. The application holds data based on year and month. and the user may query all data based also on date.
Like I said before ... Merge table may be the best solution for you. Here's some excerpt from MySQL website:

MERGE tables can help you solve the following problems:
  • Easily manage a set of log tables. For example, you can put data from different months into separate tables, compress some of them with myisampack, and then create a MERGE table to use them as one.
  • Obtain more speed. You can split a big read-only table based on some criteria, and then put individual tables on different disks. A MERGE table on this could be much faster than using the big table.
  • Perform more efficient searches. If you know exactly what you are looking for, you can search in just one of the split tables for some queries and use a MERGE table for others. You can even have many different MERGE tables that use overlapping sets of tables.
Reply With Quote
  #9 (permalink)  
Old 09-11-09, 09:10
mike_bike_kite mike_bike_kite is offline
vaguely human
 
Join Date: Jun 2007
Location: London
Posts: 2,519
Quote:
Originally Posted by mnirwan
Merge table may be the best solution for you.
I've never used this feature but I agree it seems to offer the easiest solution. However the underlying problem is the database design and I thought it worth querying why the tables were split that way.
Reply With Quote
  #10 (permalink)  
Old 09-11-09, 18:50
mnirwan mnirwan is offline
Registered User
 
Join Date: Sep 2009
Posts: 64
Quote:
Originally Posted by mike_bike_kite
I've never used this feature but I agree it seems to offer the easiest solution. However the underlying problem is the database design and I thought it worth querying why the tables were split that way.
I've used this feature at work for tables with billions of rows. However, even then, I only have 4 split tables. You are right. There's underlying problem of having 100 tables.
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