mysql - [PHP-PDO What is making my query slowdown? -
we working on private forum solution , have table of "posts" has :
- 1 index (primary key)
- unique key ( i.e. slug / seo-url of respective post )
- 2 foreign keys ( refering category(id) , user(id) category of post , op of post.
now, id ( primary key), category (id) , user(id) int(11) unsigned , have used following , results in 0.2xx seconds (on php page):
- using php pdo
- using php-mysqli
- using php pdo persistent connection , buffered queries
query: both give same performance (in range of 0.17-0.2xx seconds)
- select rows post,category,user post.userid=user.id , post.categoryid=category.id , post.id=1; -> gives result in 0.17 0.28 seconds on average
- select wors post inner join category on post.categoryid = category.id inner join user on post.userid = user.id -> tag bid faster earlier still on slower part.
now when use mybb or phpbb , part of testing, things load all queries including selecting sessions, updating row , inserting within 0.2 seconds. softwares doing?
we used pdo connection, prepare, bind execute.same mysqli.
as forward step, created view necessary columns 3 tables in 1 view again gives same performance.
what doing wrong, single query takes 0.18-0.2xx seconds whereas complete page gets displayed (with more 1 select+update+select) faster.
case: mybb / phpbb , customised forum used on same machine same php-mysql configuration , 2 users simulataneously accessing site (1 user 2 different browsers)
what doing wrong
you looking in wrong direction. every measure took has nothing query performance.
what have study explain
output given queries, , set indexes accordingly, make these queries use indexes tables involved.
Comments
Post a Comment