I have a table with over 4 million rows, I want to split this table in more tables, i.e one table with 50k rows. I also need to perform a search on these tables, whats the best way to do it? with JOIN, or? do you have some better ideas?
Best Regards,
QUERY
$do = $this->select()
->where('branche LIKE ?',''.mysql_escape_string($branche).'%')
->order('premium DESC');
Zend_Paginator
$d = $firmen->doSearch($finalType,$theKeyword,$theP开发者_开发问答LZ,$theBranche,false,false,false,$theOrder);
$paginator = new Zend_Paginator(
new Zend_Paginator_Adapter_DbSelect($d)
);
if ($d !== false) {
//$paginator = Zend_Paginator::factory($d);
$paginator->setItemCountPerPage(5)
->setPageRange(10)
->setCurrentPageNumber($pag);
$this->view->data = $paginator;
You should look into mysql table partitioning. Assuming you have a good key to split on, with the correct indexes you can get alot of speed gain from doing that. You don't want to manually do it and use join, as that won't work.
http://dev.mysql.com/doc/refman/5.1/en/partitioning-overview.html
精彩评论