I try to log everything in SQL, so add a table called I log in as everything: login, check permissions, see page , Obs I used to think that some of the log restoration implementation is required, so some log records are re-instated, none of these, OK when I need to log in every thing is fine. But when I need to look at logs: get all the records from the So I need to speed up the process When adding it to Create a view with this selection command Add simple datatype columns instead of XML Normal Add cluster pk to datatype column What are your thoughts? any suggestion? In general, a small space should be used as possibly possible; This helps greatly reduce the disk while executing the query and requires less time than the smaller data! The following tuning columns can be done: Index optimization is also very important Is important. Use an index on multiple columns if your query tests multiple columns at the same time. For example, if you select all the rows of comfort according to a certain amount of time related to a particular IP, then it will greatly increase the speed of the query: If you need to retrieve all the recordable rows from the IP address according to a specific action, In the method, such as index should be selected: etc. To be honest, in order to properly optimize, I really need to see your full SQL query ... log Think and add to it There is every
log table:
ID UNIQUEIDENTIFIER - PK
NETWORK
UniqueID BIGINT
log < / Code> The table is about 8 lakh records, but the recordable record is about 200 thousand, so every time we need to restore, we need to choose between 8 lakhs, then I decide to add a new table and this new rythm To add a log of comfortably:
log_restore :
ID UNIQUEIDENTIFIER
logad DATETIME
IP NVARCHAR
Action NVARCHAR
UniqueID BIGINT - PK
log process and merge it with the
log_restore table.
log_restore , add it to the
logs table (hence there is no need of the union)
B IGINT
IP
restitutional type column BIT indicates that a log entry or re
information column is correct: it would be better to use text or NTN data type
action Instead of using an NVRAR type for you, you have all possible actions in a
verb {/ code> table (assuming they are in a finite number), and they are an integer foreign key (as small as , The better)
Nonclassed index IX_IndexName Log on to ASC, IP ASC, LogiAtt ASC)
logs Anolstrd Index IX_IndexName make (IP ASC Action ASC, Logdiatt ASC)
No comments:
Post a Comment