Connection speed problems

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
kuvera
Forum Newbie
Posts: 2
Joined: Thu Feb 01, 2007 2:38 am

Connection speed problems

Post by kuvera »

Hello, I have a php program on its dedicated server, but it works very slowly even on the localhost. I need your help to find out where the problem is.

The server has 1 GB ram, Ubuntu Edgy, Apache 2.0.55, php 5.1.6, mysql 5.0.24a-9, php-mysql 5.0.24a-9. The program uses Adodb library, but phpMyAdmin is just as slow, so the problem is elsewhere. There is no update to php mysql client for Edgy.

In my.cnf the settings are more than I actually need:

skip-name-resolve
key_buffer = 16M
max_allowed_packet = 16M
thread_stack = 128K
thread_cache_size = 8
query_cache_limit = 2M
query_cache_size = 50M
query_cache_type = 1


I made a query test, medium complicated. On my windows test machine it takes 0.5-1 sec to execute. On linux mysql console 0.26 sec. But from PMA and from the program it's about 13 sec when not cached. So I suspect php-mysql connection problems. But how do I solve this?

TIA
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Are you sure it's not PHP, or an Apache-PHP problem?
kuvera
Forum Newbie
Posts: 2
Joined: Thu Feb 01, 2007 2:38 am

Post by kuvera »

I really don't know what the problem is.
Let's forget my program for now. I am pretty sure that PhpMyAdmin works well. I use the SQL tab and watch the query time after processing.
For simple queries it's a small amount of time, but as soon as the query gets a little complex, it becomes much more than expected. Here's an example.

Code: Select all

SELECT t0.fotetelid, altetel, gytokszel, gytokmag, (
gytokszel * gytokmag /1000000
) * t1.darab
FROM `ajanlattetel` AS t0
RIGHT JOIN (

SELECT fotetelid, (
db_jobbos + db_balos
) AS darab
FROM `ajanlattetel`
WHERE `ajanlatid` =361 && altetel =0 && aktiv =1 && torolt =0
ORDER BY fotetelid, altetel
) AS t1 ON t0.fotetelid = t1.fotetelid
WHERE (
altetel !=0 || t0.fotetelid NOT
IN (

SELECT fotetelid
FROM `ajanlattetel`
WHERE `ajanlatid` =361 && altetel !=0 && aktiv =1 && torolt =0
)
)
ORDER BY fotetelid, altetel
There are two subqueries, but the tables involved in this query have 626 and 2132 rows, and the number of rows returned are 28. Why does it take 13-15 seconds to execute, and only from within php on linux?

The first subquery returns 23 rows in 0.0083. The second: 12 rows/0.0113.
Post Reply