Drop Table
Support Forum for database administrators and web based access to important newsgroups related to databasesI am experiencing the following problem; I boot my Windows 2000 sp#4 machine. I check sqlservr.exe's memory usage in Task manager. It is ca 20 mb, everything is OK. Then I run this query; select postoffice, count(*) as counter from tblTable where postoffice is not null group by postoffice order by counter DESC There's no index or constraint on field "postoffice" and tblTable contains ca 916.000 rows. I thought this query would still execute in only a few seconds, but it takes minutes. And the worst thing is that sqlserver.exe's memory usage grows to about 300-400 mb when the query runs. What am I doing wrong?? Tnx in advance! /Magnus
Post Follow-up to this messageHi 916'000 rows and no index? It is best to have an index for larger tables else it has to load each row and look at it. Have a look at http://www.sql-server-performance.com/ for some ideas. INF: SQL Server Memory Usage: http://support.microsoft.com/defaul...b;en-us;q321363 -- -------------------------------- Mike Epprecht, Microsoft SQL Server MVP Zurich, Switzerland MVP Program: http://www.microsoft.com/mvp Blog: http://www.msmvps.com/epprecht/ "Magnus Österberg" wrote: > I am experiencing the following problem; > > I boot my Windows 2000 sp#4 machine. I check sqlservr.exe's memory usage i n > Task manager. It is ca 20 mb, everything is OK. Then I run this query; > > select postoffice, count(*) as counter from tblTable > where postoffice is not null > group by postoffice > order by counter DESC > > There's no index or constraint on field "postoffice" and tblTable contains > ca 916.000 rows. I thought this query would still execute in only a few > seconds, but it takes minutes. And the worst thing is that sqlserver.exe's > memory usage grows to about 300-400 mb when the query runs. What am I doin g > wrong?? > > Tnx in advance! > > /Magnus > > >
Post Follow-up to this messageOn Mon, 29 Aug 2005 12:31:12 +0300, "Magnus Österberg" <magnus.osterberg@abo.fi> wrote: >I am experiencing the following problem; > >I boot my Windows 2000 sp#4 machine. I check sqlservr.exe's memory usage in >Task manager. It is ca 20 mb, everything is OK. Then I run this query; > >select postoffice, count(*) as counter from tblTable >where postoffice is not null >group by postoffice >order by counter DESC > >There's no index or constraint on field "postoffice" and tblTable contains >ca 916.000 rows. I thought this query would still execute in only a few >seconds, but it takes minutes. And the worst thing is that sqlserver.exe's >memory usage grows to about 300-400 mb when the query runs. What am I doing >wrong?? That's the entire query? Nobody else on the machine? Machine has how much ram, 512mb? 1gb? More? Hmm. I'm going to guess your machine is only 512mb, that that table totals more than 512mb, on a cold run of course none of the data will be cached in RAM, and yes, SQLServer can be quite slow when it has to do physical IO, that is, far slower than when the data is in cache. SQLServer is designed to grab all available memory if it has even the least interest in doing so, so the growth to 400mb doesn't surprise me at all. You may also be getting an "autostats" on the postoffice column which will take some time, you can turn on the profiler, make sure you capture the object/autostats event, and get some idea. How long does it take if you immediately rerun the same query? Lot faster? J. J.
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread