Sorry that make a lot of sense to me (Nested SQL Views are slower). A view
has to be used in a query and is nothing more than a suggestion to the
query engine how to process. The SQE uses the information to develop a run
time plan. That is what is being run when you run the query.

The first time the query runs it might be a bit slower because the query
engine has to build a plan but after that unless something changes
dramatically in the database it will just keep executing that access plan
and won't even look at the view.

What you need to know is what is causing the query to run slower(Visual
Explain).

On Fri, Aug 24, 2018 at 12:10 PM Tommy Holden <Tommy.Holden@xxxxxxxxx>
wrote:

Views are great but stacking them (view within a view) will have negative
performance on SQL rom my experience. It's far better to simply add the
code you are nesting into one view. The more you "stack" the worse the
performance

Thanks,
Tommy Holden

Superior Services, Lasting Relationships, Stronger Communities

-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxx> On Behalf Of Greg Wilburn
Sent: Friday, August 24, 2018 2:04 PM
To: RPG programming on the IBM i (AS/400 and iSeries) <
rpg400-l@xxxxxxxxxxxx>
Subject: RE: SQL Views worth it?

My limited experience with SQL views (and views within views) for
reporting is that they are invaluable. You also have tools (index advisor)
that can improve performance dramatically. Running tools like DB2 WebQuery
and others would have been nearly impossible with our legacy database,
without using SQL views.

Personally, I would not be thinking about DDS described logical files.
Just my humble opinion.

Greg

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Thomas
Garvey
Sent: Friday, August 24, 2018 2:11 PM
To: RPG programming on the IBM i (AS/400 and iSeries) <
rpg400-l@xxxxxxxxxxxx>
Subject: SQL Views worth it?

Hi,

I'm developing a new application and trying to have the DB do as much of
the work as possible.
So, I'm incorporating SQL Views but finding the throughput underwhelming.
Granted that some of the views are based on other views (in keeping with
the attempt to have the DB do some work for me) but it appears that every
time a view is queried the views are rebuilt by the OS.

I read somewhere that Views can be considered somewhat like logical files,
but at least logicals can be set to have immediate updates as underlying
physicals change.
Views have no such attribute settings.

So, what's considered best practices for SQL Views?
Should I just rewrite these things as logicals?

--

Best Regards,

Thomas Garvey


--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit:
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.midrange.com%2Fmailman%2Flistinfo%2Frpg400-l&amp;data=02%7C01%7CTommy.Holden%40tmcat.com%7C4c261340e53c4f397b5808d609f45a96%7C7bedfe4f5ee143529ded95e9c966aa39%7C0%7C0%7C636707342434951291&amp;sdata=RAwV448a5tBCqNJ%2FHe9aKXOWxaEYL1di9xh7ImfVJMM%3D&amp;reserved=0
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Farchive.midrange.com%2Frpg400-l&amp;data=02%7C01%7CTommy.Holden%40tmcat.com%7C4c261340e53c4f397b5808d609f45a96%7C7bedfe4f5ee143529ded95e9c966aa39%7C0%7C0%7C636707342434951291&amp;sdata=IcaLZBx8is2ejaqyS2GZh8VkKHVwCFdbX1wXiTAeml4%3D&amp;reserved=0
.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link:
https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Famzn.to%2F2dEadiD&amp;data=02%7C01%7CTommy.Holden%40tmcat.com%7C4c261340e53c4f397b5808d609f45a96%7C7bedfe4f5ee143529ded95e9c966aa39%7C0%7C0%7C636707342434951291&amp;sdata=dedGzVUHYE1amwZeuSiQoj2mEBL4FZxICIXNuij6SRY%3D&amp;reserved=0
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit:
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.midrange.com%2Fmailman%2Flistinfo%2Frpg400-l&amp;data=02%7C01%7CTommy.Holden%40tmcat.com%7C4c261340e53c4f397b5808d609f45a96%7C7bedfe4f5ee143529ded95e9c966aa39%7C0%7C0%7C636707342434951291&amp;sdata=RAwV448a5tBCqNJ%2FHe9aKXOWxaEYL1di9xh7ImfVJMM%3D&amp;reserved=0
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Farchive.midrange.com%2Frpg400-l&amp;data=02%7C01%7CTommy.Holden%40tmcat.com%7C4c261340e53c4f397b5808d609f45a96%7C7bedfe4f5ee143529ded95e9c966aa39%7C0%7C0%7C636707342434951291&amp;sdata=IcaLZBx8is2ejaqyS2GZh8VkKHVwCFdbX1wXiTAeml4%3D&amp;reserved=0
.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link:
https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Famzn.to%2F2dEadiD&amp;data=02%7C01%7CTommy.Holden%40tmcat.com%7C4c261340e53c4f397b5808d609f45a96%7C7bedfe4f5ee143529ded95e9c966aa39%7C0%7C0%7C636707342434951291&amp;sdata=dedGzVUHYE1amwZeuSiQoj2mEBL4FZxICIXNuij6SRY%3D&amp;reserved=0
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD


This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2020 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].