Jump to content

Recommended Posts

hey guys... Sorry if i am posting this one in the wrong forum. We just have a problem in our company.. All our systems are loading so slow that takes about a minute or so and many are complaining about it:

 

We have about

4 systems created in VB6 and about 4 systems created in PHP

We use Mysql Database and the version is 4.1.10

 

We only use 1 machine, our database and codes resides in there:

 

For the VB system :

System 1: maximum of 200 user at a time, about 4GB database in size

System 2: maximum of 20 user at a time, about 6GB database in size

System 3: maximum of 10 user at a time, about 5GB database in size

System 4: maximum of 15 user at a time, about 4GB database in size

 

For the PHP System:

System 1: maximum of 200 user at a time, about 8GB database in size

System 2: maximum of 200 user at a time, about 2GB database in size

System 3: maximum of 200 user at a time, about 1GB database in size

System 4: maximum of 200 user at a time, about 3GB database in size

 

 

Base from the info above guys what do you think is the reason why our systems are loading very slow....

Is it because our database is going bigger and bigger? or because of the number of user?

 

We do have a proper index in our table and we also use LIMIT in our queries....

 

 

Tnx everyone...

Link to comment
https://forums.phpfreaks.com/topic/245168-systems-loading-very-slow/
Share on other sites

Do you have any heavy queries running?

mysql> show full processlist;

 

Do your servers get too much traffic to handle?

tail -f /usr/weblogs/access.log

 

Do an explain on all your queries, and make sure they are using an index, if not modify the query or create an index that the query can use. if it is using an index, can you make the index better?

In the slow query logs I can see something like this, what does it means?

 

# Query_time: 16  Lock_time: 0  Rows_sent: 2  Rows_examined: 870923

# Query_time: 14  Lock_time: 0  Rows_sent: 0  Rows_examined: 870920

# Query_time: 15  Lock_time: 0  Rows_sent: 94  Rows_examined: 871013

 

- And we can also see that there are a lots of SELECT *, SELECT distinct  in our queries will modify this one can help the performance?

- And also we find out that the VB systems are not closing the connection after script execution, does also closing the connection will help increase the performance?

- And does running OPTIMIZE table will also help increase the performance

 

And also currently we are now modifying some of our queries... I will be back soon after we reconstruct our heavy queries....

 

Thanks for all your help guys.....

In connection with the previous post, here is my query:

 

Query1:

select depbank,left(unitspaid,3) as unitspaid, sum(checkamtfx) as checkamtfx  from pdc where statusdate = '2009-09-04' and right(depbank,1) = 'D' and right(checkstatus,2) = '-R' group by left(unitspaid,3),depbank

 

Query2:

insert into `cashpos3` (mbtcho)SELECT distinct depbank from pdc where statusdate = '2009-09-04' and right(depbank,1) = 'D' and right(checkstatus,2) = '-R'  and not isnull(depbank) and depbank <> ''

 

Query3:

SELECT * FROM pdc WHERE depbank='MBTCHO' AND checktype <> 'ADV' AND batch ='2009-09-07' AND (NOT ISNULL(checkno) AND checkno<>'') AND RIGHT(checkstatus,2)<>'-H' order by checktype,pullorder

 

Pls. see attach file for the accompanying EXPLAIN....

note: Query2 is an insert select type query, I obtain the EXPLAIN by removing the INSERT INTO and replacing it by EXPLAIN.

 

[attachment deleted by admin]

I will try working on the indexes because the tables already have 3 indexes that are used by other queries... How many indexes can I create in a table? the table has 42 fields..

 

Sorry but I don't understand this question..

  Why are you querying on parts of a column?

 

Do you mean this part: right(depbank,1) = 'D' and right(checkstatus,2) = '-R'

 

The queries and tables are created by the previous developers, what I am doing right now is trying to optimize the performance of the system...

 

Tnx bro.....

 

tnx for the reply bro... the difference is very noticeable when i add index to that fields... but it's quite a big system so I will try to optimize them all... tnx a lot...

You don't want to optimize ALL of them.  You wan't to optimize the slowest & most frequently executed ones.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.