Question
mysql caching
I'm having some significant slowness on a site. It's all run
via mysql
queries. I've set the following:
query_alloc_block_size 8192
query_cache_limit 2048000
query_cache_min_res_unit 8192
query_cache_size 268435456
query_cache_type ON
I just rebooted the server a couple of hours ago and the status shows:
Qcache_free_blocks 1
Qcache_free_memory 268014808
Qcache_hits 52
Qcache_inserts 148
Qcache_lowmem_prunes 0
Qcache_not_cached 501
Qcache_queries_in_cache 148
Qcache_total_blocks 302
All of my "monthly" pages have queries in this style:
SELECT SQL_CACHE *
FROM vw_Monthly
WHERE Airdate LIKE 'YYYY-MM%'
ORDER BY Airdate DESC
(the YYYY-MM would have an actual date)
I *think* my issue is coming from the query on my main page.
SELECT MediaALT, MediaIcon, FilePath, FileName, BGsound, Airdate,
ProgramTitle, ContentText, Actor1, Actor2, Actor3, Actor4, Actor5,
Character1, Character2, Character3, Character4, Character5, InMemoriam,
MemoriamText, Program
FROM tblContent
WHERE MONTH(Airdate) = MONTH(CURRENT_DATE) AND YEAR(Airdate) =
YEAR(CURRENT_DATE) AND Airdate <= CURRENT_DATE() ORDER BY Airdate DESC
I just changed this main page query to
$thisMonth = date('Y-m');
$thisDate = date('Y-m-d');
SELECT SQL_CACHE * FROM vw_MainPage WHERE Airdate >= '$thisMonth.''-01' AND
Airdate <= '$thisDate'
the goal is to show any entry for the current month only and not show any
entries that are scheduled for later in the month. Does my approach look
like I'm going in the right direction?
queries. I've set the following:
query_alloc_block_size 8192
query_cache_limit 2048000
query_cache_min_res_unit 8192
query_cache_size 268435456
query_cache_type ON
I just rebooted the server a couple of hours ago and the status shows:
Qcache_free_blocks 1
Qcache_free_memory 268014808
Qcache_hits 52
Qcache_inserts 148
Qcache_lowmem_prunes 0
Qcache_not_cached 501
Qcache_queries_in_cache 148
Qcache_total_blocks 302
All of my "monthly" pages have queries in this style:
SELECT SQL_CACHE *
FROM vw_Monthly
WHERE Airdate LIKE 'YYYY-MM%'
ORDER BY Airdate DESC
(the YYYY-MM would have an actual date)
I *think* my issue is coming from the query on my main page.
SELECT MediaALT, MediaIcon, FilePath, FileName, BGsound, Airdate,
ProgramTitle, ContentText, Actor1, Actor2, Actor3, Actor4, Actor5,
Character1, Character2, Character3, Character4, Character5, InMemoriam,
MemoriamText, Program
FROM tblContent
WHERE MONTH(Airdate) = MONTH(CURRENT_DATE) AND YEAR(Airdate) =
YEAR(CURRENT_DATE) AND Airdate <= CURRENT_DATE() ORDER BY Airdate DESC
I just changed this main page query to
$thisMonth = date('Y-m');
$thisDate = date('Y-m-d');
SELECT SQL_CACHE * FROM vw_MainPage WHERE Airdate >= '$thisMonth.''-01' AND
Airdate <= '$thisDate'
the goal is to show any entry for the current month only and not show any
entries that are scheduled for later in the month. Does my approach look
like I'm going in the right direction?