简体   繁体   English

Zend框架表关系

[英]Zend Framework table Relationships

I have a table with over 4 million rows, I want to split this table in more tables, ie one table with 50k rows. 我有一个超过400万行的表,我想将此表拆分为更多表,即一个有5万行的表。 I also need to perform a search on these tables, whats the best way to do it? 我还需要在这些表上执行搜索,最好的方法是什么? with JOIN, or? 用JOIN,还是? do you have some better ideas? 你有更好的主意吗?

Best Regards, 最好的祝福,

QUERY 查询

            $do = $this->select()
              ->where('branche LIKE ?',''.mysql_escape_string($branche).'%')
              ->order('premium DESC');  

Zend_Paginator Zend_Paginator

        $d = $firmen->doSearch($finalType,$theKeyword,$thePLZ,$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. 您应该查看mysql表分区。 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 http://dev.mysql.com/doc/refman/5.1/zh-CN/partitioning-overview.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM