Full scans are bad, and I know this. I am seeing some on my database, and I know that some are unavoidable....but what I would like to do is find out which queries are causing them. I have over 500 users in my DB at any one time, and SQL Profiler doesn't seem to help me.....it shows me what objects are being scanned, but not if the scan is a full-scan or an index scan.
Does anyone have a way to find out what is causing my full scans?
Hi all. Anyone know if sql server collects stats on how many fulltable scans a table gets and if so how do I get at those stats? Tryingto track down poorly indexed tables / processes and I am guessing thatsql server does have this data secreted away somewhere much like mydb2 and informix databases do.
if someone can point me to documentation on this I would appreciate it.....
If there isn't any....
I am wondering about the behavior of SQL Server for table scans. In other databases tables scans are not really table scans, they are scans of the underlying tablespace for all the rows that are in the table.....and if many tables are placed into the same tablespace then the obvious slowdown occurs as rows are scanned that are not in the table.
This used to be the case in server 7......but is it still the case in 2005 that if the explain says 'table scan' it will in fact scan the filegroup the table is in?
Some other databases also have a map of the row numbers and the table it is in and the optimiser decides whether to scan the data itself or to navigate through the map and fetch a row at a time depending on the stats....
It seems that the grahical explain does not tell me more than 'table scan'. Is there any way to see down to the physical level of what the optimiser is going to do?
I have a query which is quite complex. It's based on a set of data ina complex view which takes the data from several tables.In this complex query, if I allow the various parts of the query towork on the results of the view (MISView), it can take 15 minutes torun (eek !), however, if I create a temporary table with the data fromthe view and then use that for the remainder of the query, it runs inapprox 20 seconds.Now, I have examined the execution plan (my new favourite toy) andthere is a difference (as expected). However when looking at the partof the query that takes up most of the time, it shows that it bringsback 109,645,866 records from a table (Credit) that contains 13,002records. This table is one that is referenced in the view (MISView)which contains 13,653 records and does get some of it's data from thetable which is scanned (Credit).For the record, we don't have any tables with over 100,000 records in,so 109 million rows is going some for us. The part of the query thatruns slow does reference another copy of itself but this is necessaryfor the equation that is being run.Now I'm OK with why it's doing the table scan, but why does it bringback substantially more data than is in the table ? Is it somemultiple of the number of records that it's trying to work out. Iassume it tries to run a seperate plan for the view as part of it'sprocess.Ideally, I'm still going to go down the route of the temporary table,but I would like to understand more about what it does first as Idon't like leaving things unanswered.Any help would be appreciated.
How do you track changes to objects in SQL Server. For example changes in stored procedure,views and indexes. What system table or column track or indicate changes in text of sp or views. Help appreciated.
We are building an inventory management system complete with BOM. It is important to track what employee is updating what tables. Currently all such tables have a Date field that is updated when a change is made, and an EmployeeID field which records the employee making the change. I am wondering if someone knows of a better way to track this information. Any suggestions?
OK. For DDL, please refer to the classical Northwind ORDERS table,problem/challenge, find the longest duration (start_date andend_date), during which, no orders were placed.FYI, column names by the order of colid per syscolumns:OrderIDCustomerIDEmployeeIDOrderDateRequiredDateShippedDateShipViaFreightShipNameShipAddressShipCityShipRegionShipPostalCodeShipCountryAny idea/approach? TIA.
Hi I'm trying to get CDC going, it works however when i query the LSN using the functions i get no changes. The min and max LSN returns null. SQL agent is running, db is on full recovery model etc.
Yesterday I had problem with that a sp that contained join that the developer had forgotten the where part. The sp join very large tables and sp took more 95% dual itanium processor. How do fastest track this down when it accrues. Find the sp or sql that running and consume this much processor resources. I tried with a lot. Sp_who, sp_who2, activity monitor.
im trying to create a procedure that will insert/update a small table that has an ID, AmtBefore & AmtAfter.
this is just a table that i'd be using to monitor other activity on the database.
i'm really pulling a price + ID every hour and i need to track that somehow and know when the procedure runs if a price is lower than it was the last hour, plus of course keep the ID's straight. does anyone have a good approach to something like this?
We are building an inventory management system complete with BOM. It is important to track what employee is updating what tables. Currently all such tables have a Date field that is updated when a change is made, and an EmployeeID field which records the employee making the change. I am wondering if someone knows of a better way to track this information. Any suggestions?
I have several transaction tables on which I need to track the changes. That is I need to maitain the history of changes. Only few column values are changed often.
Which is the best way for tracking the changes.
1.Store the whole record after the change ?
Or
2.Store the ColumnName & its respective old & new value ?
Or any other better.
Note : UI part & SP's will take care of the tracking & no plans for triggers.
I have a table in my database and it holds some important information,I want to track the users who are executing DML commands(select,update,delete) on the data in that table. Is there any way do that?If so how could i implement that.can any one help me in this regard? Thanks in advance...
First thank you for all your help thus far. Now I'm stuck again. I've been doing a lot of reading on triggers and logging information into tables but I've been trying to capture how many times someone enters an item into the search box.
So every time somebody types Gumballs into the search box I want to capture it and the name of the person who is currently logged in. Is there away to do this? Maybe this is something that I should be checking in ASP.NET forums?
Hello everyone, I have a fairly unique need :) I am trying todetermine the use/clients for databases in my corporation that I ammaintaining, but that noone seems to know what they are for. Many ofthese databases never seem to have anybody connected to them in thecurrent activity.What I'd like to do is find a way to audit the logins, so everytimesomeone connects to a database it simply logs the clients IP address,what login they used, and maybe what time. I've been searching googlefor this and have found tons of information on auditing the logins,but not the clients, such as by ip. Any help in this regard would beGREATLY appriciated!Joshua
I have a device application that simply needs to upload data to a server. The preferred DB server is Oracle but I've made it work using RDA and SQL Server. The problem I'm having is that it just needs to upload data, whichh I send using the RDA.Push() method. The data arrives just fine, the first time. With every subsequent upload all of the previous data is deleted fromt he server. Apparently RDA is tracking the deletion of the previously uploaded data locally and on the next .Push deleting that data from the server.
My question is: Is it possible to prevent RDA from deleting data on SQL Server? I attempted to delete the rows from the __sysDeletedRows/__sysRowTrack tables but got a "Data is read only" error.
I hoipe someone can point me in the right direction here.
I have an application with the following requirements (using SQL CE 2 alas)
A set of tables on the server that need to be imported to the handheld. Using rda, I need to get the modifications to these tables from the server (add/edit/delete) but the handheld will never update these tables.
A set of tables on the server that need to be imported to the handheld. The handheld needs to add/edit existing records, and it needs to get any changes from the server.
A set of tables on the server where the handheld needs to import a subset of the records. It needs to add (but not edit) new records, upload the new records to the server, and download any changed (add/edit/delete) records to the handheld. What tracking options should I use in these 3 cases?
The problem comes in that I need to have some foreign key relationships in the database on the handheld. Since rda munges the names of primary keys (and indexes), I do not know of a good way to add these foreign key constraints. Any suggestions?
I want to keep track of data change and want to enter the pk such as testkey and timing in different table. is it possible without having to write trigger on the table!!!
I've got a table that has frequent updates to it. I want 100% change tracking on this table though, so we can rollback to any previous version, or just see any changes people make.
Is there a best practice for things like this? Currently, I'm using a trigger on UPDATE to take the previous values and store them in a history table. This keeps track of who changes what, and when. Plus the most recent data is seperate and more performant to access.
I've also heard about putting an 'IsActive' flag on the main table and any changes that are made just get marked as In-Active and a new record gets added.
Hi, i am trying to find a trigger that is updating a field in one of my tables.
I have a field called [ProfileDate], whenever a member is profiled, this field is populated with a GETDATE() value. I am trying to track down the trigger that updates this field.
I have a bit of a problem I could do with some help with please...
I am updating an old windows client server app that uses ADO 2.8. Slowly but surely I am migrating the code from VB6 to .NET and this now means the ADO code is going to be replaced with ADO.NET.
As it is a client server the application used to establish an ADO connection and hold on to the connection for the entire duration of the app being alive. When a user signed in it would record the user logon code in a database table along with the current @@SPID value.
When the user does something in the application it typically usees an SP to do the database work. Inside the SP it also audits the work being carried out, of course the audit trail records the user id that did the work. The way it determines who called this SP is to query the logon table using the current @@SPID to get the users logon code (remember this was paired up when the user signed in).
This all worked very nicely as only one connection was ever being used and it was always the same connection that was used. However, when I come to use ADO.NET this is no longer valid. I want to use the connection pool and follow the best practices where my connections are always obtained as late as possible and released as soon as possible.
This leave me with the problem of how to get the current users logon code in to the SPs in order for them to continue writing the audit trail. Currently I am thinking that I am going to have to send the users code in to the SP as a parameter, I just wondered if there was an alternative.
I have sql server 2000. I copied a database from one server to another. I have one table that has a full-text index. When I transferred over the database, the index still existed, but was not populated. I made sure the path for the file is pointing to a new correct location. I did "start full population". It only populated one entry @ 1MB. On the old server the index is 100MB with more than 3 million records.
I tried rebuilding, re-creating, and it all works, but when I run "start full population", it only populates 1 record. I double checked the table in question and it has over 3 million records and proper primary key.
Does any one have any idea of how to track a user access to a spesfic DB because we have an old DB and we don't know if any body using it, I know Profiler can help but I need to know when it was the last time this DB has been accessed.
Hi, I have to monitor a stored procedure. I would like to see how many time this sp is been called from the application and what was the response time? And then I'd like to saggregate the results - say in 0-1 second x number of hits occured and then from 1-3secs y number of hits occured? Any better way of doing this then to run a trace?I am not ina mood to run a trace cuz it's a prod.box. TIA. pd
Here is the situation. I have an employee who is making changes but I can't prove it. He thinks he knows more than he does and he's mess'n everything up. I would like to know if SQL or some third party product has the capability to see the change and log what was changed with the persons username attached?
Trying to determine a way to see if stored procedures are being used. I am not sure of a way to see when and if a stored procedure is being called although I have thought of using sp_recompile to set the stored procedure to recompile but I am not sure in which table that flag is set so I can see which ones were not recompiled. Any assistance or guidance would be appreciated. Thanks.
I am trying to find a way to calculate everyday my DB Growth, I did find a script on some site but it seems to give me the same information as the taskpad wich is not very specific. Basicaly i would like to know the size of a table in MB or in whatevever conversion possible, so that i will be able to do some forcasting.