php - Table with over 12 million rows running in performance problems -


now table having problems relationship table keyword analysis of websites there 5 columns (keyword_id, website_id, occurrence, percentage, date)

this allows keyword statistics website on period of time , allows visual graph representation website owner.

now problem index 57 unique keywords per website on average. , index 12000 websites everyday , because running performance problems. picture table size growing fast.

now have index on keyword_id, website id, occurrence, percentage , date). each 1 of them has index, still having problems selects.

how solve performance problem on mysql php?

note: indexes each field , 1 of them combined well.  sql query 1: select * table keyword_id = "323242" sql query 2: select * table website_id = "232" sql query 3: select * table keyword_id = "323242" order percentage sql query 4: select * table website_id = "232" order occurence sql query 5: select * table keyword_id = "323242" order occurrence sql query 6: select * table website_id = "232" order date 

what's distribution , probability of keywords? example, if had keyword used every site, every day, after 6 mos, that's 2.1m rows single key word. i'm sure that's not case, popular words going large quickly.

the website_id 1 shouldn't bad, few thousand rows.

if you're doing queries keyword_id , website_id, other indexes costing time , space (but not on read).

ideally, index on keyword_id, percentage let optimizer return rather quick result keyword_id sorted percentage query, others, can depend lot of layout of data.

how memory on box , how fast drives? @ io ops per sec when you're doing these queries. can thrashing drives.

with decent amount of memory, order clauses should pretty cheap, , cheaper sort them rather doing lots of random reads disk, that's index , how it's organized in relation pages on disk.

also, make sure have of statistics date. bad statistics murder queries.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -