Re: DB View performance

Daniel Gross <[email protected]>
Newsgroups gmane.comp.hardware.ibm.midrange
Message-ID <[email protected]>
Aside from Visual Explain I have 2 ideas:

1. try to rebuild your indexes after the view is recreated - I had such a strange experience lately with a "coupled" view/index pair

2. does "myfield" contain NULLs? Or is "myfield" part of a LEFT JOINed table/view? If not, try COUNT(*) as it does not have to inspect every value of "myfield" it is normally faster in this particular case

HTH 
Daniel



> Am 27.05.2026 um 20:09 schrieb Vern Hamberg via MIDRANGE-L <[email protected]>:
> 
> In addition to Rob's suggestion, have you run Visual Explain over both the original and the new views? Something about this makes me wonder about a table scan, although the system should know how many rows are in a table without doing a table scan. You might do a table scan on the old view, as well.
> 
> I also wonder about the plan cache - the old view has been used a lot, and optimization has found the best plan. The new view might need to be run many times to get better performance. And Visual Explain would help with getting things better sooner.
> 
> Also, if you can, run VE in an environment that has substantially the same environment - table sizes, memory, things like that.
> 
> *Regards*
> 
> *Vern Hamberg*
> 
> IBM Champion 2025 <cid:[email protected]> CAAC (COMMON Americas Advisory Council) IBM Influencer 2023
> 
> 
>> On 5/27/2026 12:47 PM, Rob Berendt wrote:
>> Did you use the tool to retrieve the SQL source of your old view and
>> compare it to the one you recreated without the new column?
>> 
>> On Wed, May 27, 2026 at 1:42 PM Greg Wilburn <
>> [email protected]> wrote:
>> 
>>> I have a relatively complicated database view that references other
>>> views.  Back in 2020, I was able to create some indexes to improve
>>> performance when this view was used.
>>> 
>>> Without going into a lot of detail, I added a column to the view to simply
>>> count the lines in the primary table (the view already groups results).  I
>>> did this generating the DDL from ACS Schemas tool.  Using run sql scripts,
>>> I did a "create or replace view" after adding the column.  This change
>>> killed the performance, so I removed the new column and ran "create or
>>> replace view" again.
>>> 
>>> Now to the odd part... the performance was still horrible.  I didn't know
>>> what to do, so I restored the view from our cloud backup - this fixed the
>>> performance issue.
>>> 
>>> My question is why?  What is happening behind the scene that I'm not
>>> considering?
>>> I honestly can't imagine that adding a "count(myfield) as mynewfield"
>>> column would dramatically affect the performance.
>>> 
>>> Greg
>>> [Logo]<https://www.totalbizfulfillment.com/>    Greg Wilburn
>>> Director of IT
>>> 301.895.3792 ext. 1231
>>> 301.895.3895 direct
>>> [email protected]<mailto:[email protected]>
>>> 1 Corporate Dr
>>> Grantsville, MD 21536
>>> www.totalbizfulfillment.com<http://www.totalbizfulfillment.com>
>>> --
>>> This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
>>> To post a message email:[email protected]
>>> To subscribe, unsubscribe, or change list options,
>>> visit:https://lists.midrange.com/mailman/listinfo/midrange-l
>>> or email:[email protected]
>>> Before posting, please take a moment to review the archives
>>> athttps://archive.midrange.com/midrange-l.
>>> 
>>> Please [email protected] for any subscription related
>>> questions.
>>> 
>>> 
> --
> This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
> To post a message email: [email protected]
> To subscribe, unsubscribe, or change list options,
> visit: https://lists.midrange.com/mailman/listinfo/midrange-l
> or email: [email protected]
> Before posting, please take a moment to review the archives
> at https://archive.midrange.com/midrange-l.
> 
> Please contact [email protected] for any subscription related questions.
> 
-- 
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: [email protected]
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: [email protected]
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact [email protected] for any subscription related questions.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.