Drop Table

Support Forum for database administrators and web based access to important newsgroups related to databases
Register on Database Support Forum Edit your profileCalendarFind other Database Support forum membersFrequently Asked QuestionsSearch this forum -> 
For Database admins: Free Database-related Magazines Now Free shipping to Texas


Post New Thread










Thread
Author

Generation of estimated execution plan takes a long time
Hello,

I am puzzled by following problem. One of our tables has more than 12
billion rows. Usually, query plan and query itself is executed almost
immediately but occasionally, it take about 2 minutes to generate estimated
query execution plan for following query:

SELECT MAX(qwEventIx) FROM FTE_STREAM_EVENT (NOLOCK)

There is a PK clustered index defined on qwEventIx field. I do not observer
any blocking on this object when it takes  a long time to generate estimated
query plan. There is a plan cached in syscacheobjects for this query.
I was wondering if anyone can explain why it takes such a long time to
generate estimated query plan on some occasions.

Thanks,
Igor



Report this thread to moderator Post Follow-up to this message
Old Post
imarchenko
10-26-05 01:23 AM


Re: Generation of estimated execution plan takes a long time
Igor,

Are the statistics current and up-to-date?

HTH

Jerry
"imarchenko" < igormarchenko@hotmai
l.com> wrote in message
news:uIwoFzZ2FHA.4076@TK2MSFTNGP09.phx.gbl...
> Hello,
>
> I am puzzled by following problem. One of our tables has more than 12
> billion rows. Usually, query plan and query itself is executed almost
> immediately but occasionally, it take about 2 minutes to generate
> estimated query execution plan for following query:
>
> SELECT MAX(qwEventIx) FROM FTE_STREAM_EVENT (NOLOCK)
>
> There is a PK clustered index defined on qwEventIx field. I do not
> observer any blocking on this object when it takes  a long time to
> generate estimated query plan. There is a plan cached in syscacheobjects
> for this query.
> I was wondering if anyone can explain why it takes such a long time to
> generate estimated query plan on some occasions.
>
> Thanks,
> Igor
>



Report this thread to moderator Post Follow-up to this message
Old Post
Jerry Spivey
10-26-05 01:23 AM


Re: Generation of estimated execution plan takes a long time
It could be that this is when auto-update of statistics occurs. You can catc
h that in Profiler using
Object, Auto Stats.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www. solidqualitylearning
.com/
Blog: http:// solidqualitylearning
.com/blogs/tibor/


"imarchenko" < igormarchenko@hotmai
l.com> wrote in message
news:uIwoFzZ2FHA.4076@TK2MSFTNGP09.phx.gbl...
> Hello,
>
> I am puzzled by following problem. One of our tables has more than 12 bill
ion rows. Usually, query
> plan and query itself is executed almost immediately but occasionally, it 
take about 2 minutes to
> generate estimated query execution plan for following query:
>
> SELECT MAX(qwEventIx) FROM FTE_STREAM_EVENT (NOLOCK)
>
> There is a PK clustered index defined on qwEventIx field. I do not observe
r any blocking on this
> object when it takes  a long time to generate estimated query plan. There 
is a plan cached in
> syscacheobjects for this query.
> I was wondering if anyone can explain why it takes such a long time to gen
erate estimated query
> plan on some occasions.
>
> Thanks,
> Igor
>


Report this thread to moderator Post Follow-up to this message
Old Post
Tibor Karaszi
10-27-05 12:27 PM


Re: Generation of estimated execution plan takes a long time
Tibor,

You were absolutely correct! SQL Server was updating statistics on 12
billion rows table. It was taking over 2 minutes. I suppose it might make
sense to disable AUTOSTATS on this table with sp_autostats and update
statistics manually during off-peak hours. Would you recommend this
approach?

Thanks,
Igor


"Tibor Karaszi" <tibor_please.no. email_karaszi@hotmai
l.nomail.com> wrote in
message news:%2311fWFg2FHA.956@TK2MSFTNGP10.phx.gbl...
> It could be that this is when auto-update of statistics occurs. You can
> catch that in Profiler using Object, Auto Stats.
>
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www. solidqualitylearning
.com/
> Blog: http:// solidqualitylearning
.com/blogs/tibor/
>
>
> "imarchenko" < igormarchenko@hotmai
l.com> wrote in message
> news:uIwoFzZ2FHA.4076@TK2MSFTNGP09.phx.gbl... 
>



Report this thread to moderator Post Follow-up to this message
Old Post
imarchenko
10-28-05 06:23 PM


Re: Generation of estimated execution plan takes a long time
Jerry,

It is indeed statistics related.

Thanks,
Igor

"Jerry Spivey" <jspivey@vestas-awt.com> wrote in message
news:uQmyqVa2FHA.2364@TK2MSFTNGP12.phx.gbl...
> Igor,
>
> Are the statistics current and up-to-date?
>
> HTH
>
> Jerry
> "imarchenko" < igormarchenko@hotmai
l.com> wrote in message
> news:uIwoFzZ2FHA.4076@TK2MSFTNGP09.phx.gbl... 
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
imarchenko
10-29-05 01:23 AM


Re: Generation of estimated execution plan takes a long time
Yes, with that long auto.stats time, disabling autostats for that table is r
easonable. Make sure you
schedule manual update statistics with a reasonable sample and at a good tim
e (like not before some
big batch, but after :-) ).

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www. solidqualitylearning
.com/
Blog: http:// solidqualitylearning
.com/blogs/tibor/


"imarchenko" < igormarchenko@hotmai
l.com> wrote in message
news:e1KGDu%232FHA.3420@TK2MSFTNGP15.phx.gbl...
> Tibor,
>
>    You were absolutely correct! SQL Server was updating statistics on 12 b
illion rows table. It
> was taking over 2 minutes. I suppose it might make sense to disable AUTOST
ATS on this table with
> sp_autostats and update statistics manually during off-peak hours. Would y
ou recommend this
> approach?
>
> Thanks,
> Igor
>
>
> "Tibor Karaszi" <tibor_please.no. email_karaszi@hotmai
l.nomail.com> wrote i
n message
> news:%2311fWFg2FHA.956@TK2MSFTNGP10.phx.gbl... 
>
>


Report this thread to moderator Post Follow-up to this message
Old Post
Tibor Karaszi
10-29-05 01:23 AM


Sponsored Links





Last Thread Next Thread
Post New Thread

MS SQL Server archive

Show a Printable Version Email This Page to Someone! Receive updates to this thread
Microsoft SQL Server
Access database support
PostgreSQL Replication
SQL Server ODBC
FoxPro Support
PostgreSQL pgAdmin
SQL Server Clustering
MySQL ODBC
Web Applications with dBASE
SQL Server CE
MySQL++
Sybase Database Support
MS SQL Full Text Search
PostgreSQL Administration
SQL Anywhere support
DB2 UDB Database
Paradox Database Support
Filemaker Database
Berkley DB
SQL 2000/2000i database
ASE Database
Forum Jump:
All times are GMT. The time now is 02:29 PM.

 
Mobile devices forum | Database support forum archive




Copyrights DropTable.com Database Support Forum 2004 - 2006