一个表,大概千万行级别 -_-! 然后有一列 X 里面是 int 范围是1到5. 要读出所有 X>=3 的行。 貌似写代码的时候,直接用一个sql 语句,然后 while()循环处理的话, 会把所有的行先读到内存中去,会出现内存不够的情况。 不知道这个怎么解决呢? 试过用limit分成几段读,但是还是很慢,尤其是到了最后几段,时间越来越长。 应该是每次都从头扫描起的。 有没有什么其他的办法呢?比如程序上的方法?数据库的表上索引改一改? p.s. 现在X列上有普通索引。
s*s
5 楼
Free eBook: SQL Server Transaction Log Management When a SQL Server database is operating smoothly and performing well, there is no need to be particularly aware of the transaction log, beyond ensuring that every database has an appropriate backup regime and restore plan in place. When things go wrong, however, a DBA's reputation depends on a deeper understanding of the transaction log, both what it does, and how it works. http://www.red-gate.com/products/dba/sql-backup/entrypage/trans
Responsibilities - Leading product development, including ELN, RegMol, Chem4SharePoint and TouchMol - Some customer support Requirements - 5+ years software development experience with C++, Java or .NET - 2+ years ASP.NET experience - 2+ years database experience - 2+ years Javascript experience- Science background is preferred - Good Communication skills http://www.scilligence.com/web/jobs.aspx
since it is array in the struct, the data is allocated as part of struct. And (uint32_t)x.port will be treated as starting address of the array since type of x.port is an array. Thus it is the same as &x.port