我可以创建“逻辑文件”吗?在AS400中使用sql?
我需要创建 as400“逻辑文件”。
我的应用程序使用 jdbc 连接到数据库。
是否可以用sql语句创建“逻辑文件”?
如果是的话,我希望能提供一份示例声明。
谢谢
I need to create as400 "logical files".
my app connects to the db with jdbc.
Is it possible to create "logical files" with sql statements ?
If yes I would appreciate a sample statement.
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我建议使用绿屏 STRSQL 命令中的 CREATE INDEX SQL 命令。然后就可以提示了。下面是 CREATE INDEX 的示例,它可以让我更快地查询 16 GB 文件。对于此示例,物理文件是数据库监视器运行一周的结果:
索引本身需要很长时间才能创建,但基于索引的后续查询非常快。
如果您需要连接多个表,请提前计划。了解将用于连接表的字段并针对连接的表创建索引。您将获得所需的性能提升。例如,让我们创建一个查询来显示客户订购的商品:
您将创建以下索引(如果它们尚不存在):
如果您需要创建一个逻辑文件选择/省略条件,那么您需要创建一个视图。不过,视图不是索引,并且您不能像使用带有 select/omits 的键控逻辑那样混合索引和视图。为此,DDS 规范仍然是最好的。
I suggest making use of the CREATE INDEX SQL command from the green-screen STRSQL command. Then you can prompt it. Here is an example of CREATE INDEX that let me query a 16 gigabyte file much faster. For this example, the physical file was the results of a database monitor than ran for a week:
The index itself took a long time to create, but subsequent queries based on the index were very fast.
If you need to join multiple tables, plan ahead. Know the fields you will use to join the tables and create indexes against the joined tables. You'll get the performance increase you're looking for. For an example, let's make up a query to show the items ordered by a customer:
You would make the following indexes, if they didn't already exist:
If you need to create a logical file select/omit criteria, then you need to create a view. A view is not an index, though, and you can't mix an index and a view like you can with a keyed logical with select/omits. For that, a DDS spec is still the best.
如果您尝试根据您的视图进行排序,这将有所帮助,但如果您遇到性能问题,这不会真正有帮助。
数据示例
basetable
:查询:
来自
myview1
的数据示例This will help if you are trying to an order by on your view, but will not really help if you have a performance issue.
Sample of data
basetable
:Query:
Sample of data from
myview1
为了达到大致相同的效果,我在 AS/400 DB2 中的所有表上创建了数据库视图,将更容易理解的名称映射到物理名称。我不认为视图是逻辑文件,但我只是所说的 AS/400 的用户,并且对它的了解与与数据交互所需的一样多。
To achieve much of the same effect, I've created database views over all the tables in an AS/400 DB2, mapping more understandable names to the physical ones. I don't think views are logical files, but I'm just a user of said AS/400 and know exactly as much about it as needed to interact with the data.