Tuesday, October 19, 2010

How to identify real and can automatically create index index



Q: I found a lot of sysindexes index table entries are not created my own. I heard they are not true index, but the SQL Server query optimizer automatically creates statistics. How can I identify which is the real index, which is automatically created in SQL Server available?

A: By default, if the table is not a column index, SQL Server automatically creates statistics for columns. Then, the query optimizer to assess the distribution of column data in the range of statistical information to select a more efficient query processing program. Automatically created statistics tell a very simple, in SQL Server 7.0 and SQL Server 2000, the auto-created statistics prefix _WA_Sys.

You also can use the INDEXPROPERTY () function IsAutoStatistics property to distinguish between real or an index is automatically created in the statistics, so that SQL Server optimizer choose need to create statistics. You can also enable you to manage the database, "automatically create tables" option.

Many people ignore the following conclusions. Statistics created automatically mean the existence of the index may be a real benefit. Please consider the following code in the output:

USE tempdb GO IF OBJECTPROPERTY (OBJECT_ID ('dbo.orders'), 'IsUserTable') = 1 DROP TABLE dbo.orders GO SELECT 1 10 11 12 13 14 15 16 17 18 19 2 20 21 22 23 24 25 26 27 28 29 3 30 31 32 4 5 6 7 8 9 INTO tempdb .. orders FROM northwind .. orders GO SELECT 1 10 11 12 13 14 15 16 17 18 19 2 20 21 22 23 24 25 26 27 28 29 3 30 31 32 4 5 6 7 8 9 FROM tempdb .. orders WHERE orderid = 10248 GO SELECT 1 10 11 12 13 14 15 16 17 18 19 2 20 21 22 23 24 25 26 27 28 29 3 30 31 32 4 5 6 7 8 9 FROM tempdb. . sysindexes WHERE id = object_id ('orders') AND name LIKE '_wa_sys%' GO

Copy the code in the tempdb in the Northwind Orders table, select the row, and then check the SQL Server is added to a statistical. Obviously, the table does not OrderId column index, so SQL Server automatically creates a named _WA_Sys_OrderID_58D1301D statistics. OrderId out the existence of statistical tables that Northwind Orders table would benefit from additional indexes.

The following query shows the database table automatically created for each user the number of statistics, the database is automatically created at least one of the statistics.

SELECT object_name (id) TableName, count (*) NumberOfAutoStats FROM sysindexes WHERE OBJECTPROPERTY (id, N'IsUserTable ') = 1 AND INDEXPROPERTY (id, name,' IsAutoStatistics') = 1 GROUP BY object_name (id) ORDER BY count (* ) DESC

Not all of the statistics can be replaced by the real index. In some cases, SQL Server will automatically create a table more than 50 statistics. Clearly, these tables index strategy is bad. Automatically created on the table and the statistics associated with the rapid count can help you determine which table to index.







Recommended links:



Infomation Animation Tools



oracle10g management system global area sga



SWF to MP4



Draw With the Freehand in the form of two laws



Jsp custom tag in depth from shallow to explain in detail



Only micro-blog IS not "micro-complaints"



Flash to MPEG



Community 2.0 My Community I Call The Shots



"Dragon Century: The Origin Of" Game Of The Background Qunari People



Introduction and Context Servlet container



Magic Assistant: Can Not Control The Computer Keystrokes



DVR-MS to MPG



Easy Tools And Editors



Wednesday, October 6, 2010

Make a IPhunter


Some people say that programmers have become assembly workers, actually makes sense to use the control module + a small amount of code can be achieved, delphi 5.0 provides a wealth of internet control, using tcp / ip client - server can resolve the problem. The key control is serversocket, we imitate iphunter interface with a button1 (button), a combobox1 (for display), the three most basic controls placed on the blank form you can start writing code.

First, the combobox1 must be able to display more than one ip, we set a variable y to accumulate combobox1.items [y],
var y: integer;
Our idea is as follows, when serversocket activities port (port) received on tcp / ip protocol when the link request, return to the other side of the ip value, passed to the combobox is displayed. Activation by the button1 control serversocket, that is, open closed ports.

We serversocket's on clientconnect event to add about code
procedure tform1.serversocket11clientconnect (sender: tobject;
socket: tcustomwinsocket);
begin
combobox1.items.insert (y ,'''');// add a blank record
combobox1.items [y]: = socket.remoteaddress; / / access each other's ip
label1.text: =''were caught''+ inttostr (y +1) +''a ip'';// with a label to display the total number of ip arrested
y: = y +1; / / counter variable by 1
socket.close;
end;
Now, the button1 the caption property is set to''Start'', in its Click event add the following code
procedure tform1.speedbutton7click (sender: tobject);
begin
if speedbutton7.caption =''Start''then
begin
serversocket11.port: = 80; / / phrase can be set in the serversocket properties, capture the browser's connection
serversocket11.active: = true; / / activate the port
speedbutton7.caption: =''stop'';
end
else
begin
serversocket11.active: = false; / / close the port
speedbutton7.caption: =''begin'';
combobox1.clear; / / end of the capture, clear the history information
y: = 0; / / Reset counter variable
end;
end;






Recommended links:



ASF converter



3GP To WMV



Avgcmgr.exe Error Eliminate Pc Errors



QT TO WMV