Querying new records issue after reomdex tables...

Currently we have database which we reindex tables every night. Therefore, in the next morning If I query records from the previous day or earlier the query results are displayed with minimal time span. The weird part comes in; if I use the same query select statment to query records that were inserted in the curent date(the morning) it takes over 10mins to execute the query select statment and display the results. I have no issues querying with previous day data but only the current day data after 1000+ insert records where inserted into the database. Any Ideas?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Do you have index on datetime column?
Scott PletcherSenior DBACommented:
What is the table's clustered index?  What column(s)?
What is the fillfactor on the clus index?
If the table is not too large, try using:

SELECT * FROM sys.sys.dm_db_index_physical_stats ( ... ) on that table's clus index.
7of9121098Author Commented:
the query uses about 4 views, no direct tables...but I'll try the SELECT * FROM sys.sys.dm_db_index_physical_stats ( ... ) on that table's clus index. on the tables the views reference.
IT Pros Agree: AI and Machine Learning Key

We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.

7of9121098Author Commented:
Hi I ran the sys.sys.dm_db_index_physical_stats and what is the acceptable avg_fragmentation_in_percent rate?
Scott PletcherSenior DBACommented:
As a rough guideline, for larger tables you like to see 10% or less.  [For medium tables, up to ~20% is OK.  For really small tables, you can even live with a little more than that.] Naturally the higher it is the worse that is.

For most heaps (tables without a clus index), you definitely want 10% or less. [A heap can have nonclus index(es) also.]

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
7of9121098Author Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.