|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Weird behavior with performancedon't know if this is a bug or an undocumented feature but i installed SQL
2005 on a server in our network. i wrote some php pages to connect and get the data. I track the time what time i costs to execute to query through php. And here comes to funny part: if i open the sql management tool and i open any property window from a database (table, index, view) i get much faster speeds. when i execute a large query directly in sql server i get execution times of 1 seconderd and lower (usually 0.21) if i do this outside via PHP for example, the execution time is 2.4 ? But when i open a property window in SQL manager and i do it again via PHP, the execution time will be the same as if i executed it directly on the sql server how is this possible ?? willem (wil***@discussions.microsoft.com) writes:
Show quote > don't know if this is a bug or an undocumented feature but i installed It is not entirely clear to me exactly what you are doing, but keep in mind> SQL > 2005 on a server in our network. i wrote some php pages to connect and > get the data. I track the time what time i costs to execute to query > through php. And here comes to funny part: > > if i open the sql management tool and i open any property window from a > database (table, index, view) i get much faster speeds. when i execute a > large query directly in sql server i get execution times of 1 seconderd > and lower (usually 0.21) > > if i do this outside via PHP for example, the execution time is 2.4 ? > But when i open a property window in SQL manager and i do it again via > PHP, the execution time will be the same as if i executed it directly on > the sql server > > how is this possible ?? that SQL Server maintains a cache. So the first time you read some data from a table, the data is read from disk. But on subsequent accesses, the data is already in memory, and access is much faster. -- Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se Books Online for SQL Server 2005 at http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx Books Online for SQL Server 2000 at http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx I am aware of that, i solved the problem: if you take a look at database
properties you will see an option "Auto close" with the default set to true. Set it to false and it is solved but i still think this is strange behavior . "Erland Sommarskog" schreef: Show quote > willem (wil***@discussions.microsoft.com) writes: > > don't know if this is a bug or an undocumented feature but i installed > > SQL > > 2005 on a server in our network. i wrote some php pages to connect and > > get the data. I track the time what time i costs to execute to query > > through php. And here comes to funny part: > > > > if i open the sql management tool and i open any property window from a > > database (table, index, view) i get much faster speeds. when i execute a > > large query directly in sql server i get execution times of 1 seconderd > > and lower (usually 0.21) > > > > if i do this outside via PHP for example, the execution time is 2.4 ? > > But when i open a property window in SQL manager and i do it again via > > PHP, the execution time will be the same as if i executed it directly on > > the sql server > > > > how is this possible ?? > > It is not entirely clear to me exactly what you are doing, but keep in mind > that SQL Server maintains a cache. So the first time you read some data from > a table, the data is read from disk. But on subsequent accesses, the data is > already in memory, and access is much faster. > > > > -- > Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se > > Books Online for SQL Server 2005 at > http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx > Books Online for SQL Server 2000 at > http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx > willem (wil***@discussions.microsoft.com) writes:
> I am aware of that, i solved the problem: if you take a look at database With auto-close the database is closed when you disconnect. This gives> properties you will see an option "Auto close" with the default set to > true. Set it to false and it is solved but i still think this is strange > behavior . quite an overhead when you connect. If you look at something in the database through Mgmt Studio, you keep that connection open to the database, snd it never closes. -- Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se Books Online for SQL Server 2005 at http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx Books Online for SQL Server 2000 at http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Other interesting topics
|
|||||||||||||||||||||||