Best way to improve the database performance

时间:2015-09-01 21:20:33

标签: sql sql-server database oracle optimization

I was recently in an interview and i have been asked a question that was : After one year of publishing your application the data in the database became massive , so what is the best way to optimize the DB performance in the DB side not in the coding side whether database is Oracle or SQL server ... i just want to know what is the best answer for this question ?

2 个答案:

答案 0 :(得分:4)

I can give you an answer, but can't guarantee that an interviewer would like it.

The best way to optimise the performance is to understand what your application does, and the data structures that the system provides. You must understand the business so that you can understand the data, and when you do that you'll know whether the SQL submitted to the system is "asking the correct question", and doing so in a way that makes sense for the data and it's distribution.

Furthermore, you should measure and document what the normal behaviour of the system is, and the cycles it might go through on a daily, weekly, monthly, quarterly and annual basis. You should be prepared to be able to quantify any deviation from normal performance.

You must understand the database technology itself. The concepts, the memory structures and processing, REDO, UNDO, index and table types, and maybe partitioning, parallelism, and RAC. The upsides and the downsides.

You must know SQL extremely well, and be completely up to date on its capabilities in your DB version, and any new ones now available. You must be able to read a raw execution plan straight from DBMS_XPlan(). Tracing query execution must be within your skill set.

You must understand query transformation and optimisation, the use of bind variables, and statistics.

If I had to choose only one of the above, it would be that you must have measured and documented historical performance, and be able to quantify deviations from it, because without that you will never know where to start.

答案 1 :(得分:0)

我非常确定问题的关键在于如何处理模糊,过于宽泛的问题。你做的一件非常积极的事情就是在SO上找到权威的答案。现在不知道面试是否会帮助你。

那么 - 你如何回答这样的问题?一个"我无法知道"可能不是采取的方法 - 即使它是正确答案。

也许是类似的事情,"我不完全确定你在问什么 - 所以让我试着用几个问题来理解。我们是在讨论查询性能还是更新性能?是否有支持工作负载的索引?是什么让你觉得优化是必要的?"

我认为解决问题的方法与任何特定技术一样重要。

但是,另一方面,也许我错了。也许第一个答案总是"将它归结为地狱!" :-D

采访是一场噩梦,不是吗?