Quantcast
Channel: Symantec Connect - Backup and Recovery
Viewing all articles
Browse latest Browse all 1524

SQL query - takes long time - help with optimization

$
0
0
I need a solution

Hi,

I have a problem with SQL query. I am not very familiar with SQL and this is probably the reason.
The SQL looks:

select
    (a.Id) as "Image", UTCBigIntToNomTime(a.writeEndTime) as "WriteEndTime",
    (select UTCBigIntToNomTime(c.copyDate)
        from domain_imageCopy c
            where (c.imageId=a.Id and c.Id='2')) as "CopyDate"
from domain_Image a, domain_Policy b
where a.policyType='4'
and b.Keyword='PLATINUM'
and (UTCBigIntToNomTime(a.writeEndTime) >= 'Mar 29 2016 00:00:00' and
    UTCBigIntToNomTime(a.writeEndTime) <= 'Mar 31 2016 23:59:59')
order by "WriteEndTime" asc

It is very short and not too complicated, but takes very long time.
If I run this on dbisqlc it can take about 30 minutes. From GUI I have error "An unknown exception occurred." Stop/start of OPSCenter does not helps.
OPSCenter DB has about 30GB, so is large but not too large. Defragmentation of DB is performed every 2 weeks.

I need SQL which generates report about every image (on policy type, keyword and other includes/excludes) and its first copy creation time and second copy creation  time
Something like this:

Image | 1st copy creation time | 2nd copy creation time

And if the image does not have second copy, should be NULL.

Any help will be appreciated

Regards

Madej

0

Viewing all articles
Browse latest Browse all 1524

Trending Articles