Select Statement Vs Find in Ax

爷,独闯天下 提交于 2019-12-11 02:38:48

问题


while writing code we can either use select statement or select field list or find method on table for fetching the records.

  I wonder which of the statement helps in better performance

回答1:


It really depends on what you actually need.

find() methods must return the whole table buffer, that means, all of the columns are projected into the buffer returned by it, so you have the complete record selected. But sometimes you only need a single column, or just a few. In such cases it can be a waste to select the whole record, since you won't use the columns selected anyway.

So if you're dealing with a table that has lots of columns and you only need a few of them, consider writing a specific select statement for that, listing the columns you need.

Also, keep in mind that select statements that only project a few columns should not be made public. That means that you should NOT extract such statements into a method, because imagine the surprise of someone consuming that method and trying to figure out why column X was empty...




回答2:


You can look at the find() method on the table and find out the same 'select'-statement there.

  • It can be the same 'select; statement as your own an the performance will be the same in this case.
  • And it can be different select statement then your own and the performance will be depend on indexes on the table, select statement, collected statistics and so on.

But there is no magic here. All of them is just select statement - no matter which method do you use.



来源:https://stackoverflow.com/questions/27163459/select-statement-vs-find-in-ax

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!