Oracle 心得
一、ORA-01476: divisor is equal to zero
错误:
SELECT * FROM tablename
WHERE executions > 0
AND disk_reads/executions > 500
正确:
SELECT * FROM tablename
WHERE executions > 0
AND DECODE(executions, 0, 0,disk_reads/executions)>;500
正确:(and条件中先执行后面的语句)
SELECT * FROM tablename
WHERE disk_reads/executions > 500
AND executions > 0
二、程序访问数据量大于10万的数据表时,需要建立索引,否则访问很慢。
SELECT * FROM apps.game_article
WHERE columnId = ?
ORDER BY createDate DESC
此时,需要对表中的columnid字段建立索引,否则访问很慢。
数据量大了以后,硬件设施跟不上的话,就几乎跟读不出数据一样。