选择语句与在轴中查找 [英] Select Statement Vs Find in Ax

查看:90
本文介绍了选择语句与在轴中查找的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在编写代码时,我们可以使用select语句或select字段列表或表上的find方法来获取记录.

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

推荐答案

这实际上取决于您的实际需求.

It really depends on what you actually need.

find()方法必须返回整个表缓冲区,这意味着所有列都将投影到由它返回的缓冲区中,因此您已选择了完整的记录.但是有时您只需要一个列,或仅几个.在这种情况下,选择整个记录可能很浪费,因为您还是不会使用所选的列.

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.

因此,如果您要处理的表包含许多列,而只需要其中几列,则可以考虑为此编写一个特定的select语句,列出所需的列.

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.

此外,请记住,不应仅公开仅投影几列的select语句.这意味着您应该不要将此类语句提取到方法中,因为想象有人使用该方法并试图弄清楚X列为何为空...的惊奇.

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...

这篇关于选择语句与在轴中查找的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆