Forum Moderators: coopster
i read "optimize" in mysql manual again and again
but still see nothing i can do with that case
table `post`
postid INT
fourmid INT
ctime INT
mtime INT
title VARCHAR
posttext TEXT
INDEX postid
INDEX forumid
SELECT * FROM post WHERE forumid=1
but for a forumid=1, there's many and many rows INSERT in `post` every day
doing a explain shows me:
string(8) key=forumid
string(5) ref=const
string(4) rows=125130 (sooo many rows)
forumid=1
any special scheme?
table post
type range
possible_keys postdate
key postdate
key_len 4
ref null
rows 509670
Extra Using where
table thread
type ref
possible_keys firstpost
key firstpost
key_len 4
ref post.postid
rows 1
Extra
table user
type eq_ref
possible_keys PRIMARY
key PRIMARY
key_len 4
ref post.posterid
rows 1
Extra
table forum
type eq_ref
possible_keys PRIMARY
key PRIMARY
key_len 2
ref post.forumid
rows 1
Extra
"It's not normally useful to.."
means there's some exception, right?
for a forum/bbs, there's many place need to list titles, not content, is this a exception case?
seems only reading the thread/post need content
/
/home.htm
/category88.htm
/forum21/
all these pages don't require content
should it be split into another table to make "post" table smaller?
$sql_1 =
"select .. from post
where forumid=1
order by postdate desc
limit 0,11";
because count(DISTINCT forumid) is not changed, in another word: limited-constant
but count(*) is endless
avengly rows of forumid=xx
equals: endless/count(DISTINCT forumid)
equals: endless/limited-constant
equals: endless
as u may think, it's nothing different from doing:
$sql_2 = "select * from table order by postdate limit $offset,$count";
two way to go:
1. add another condition in where (possible? how)
2. find possible way if we can optimized $sql_2
the problem becomes:
[webmasterworld.com...]