Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7542343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:08:28+00:00 2026-05-30T08:08:28+00:00

I have this query that runs in 7 seconds producing 12,094 records on my

  • 0

I have this query that runs in 7 seconds producing 12,094 records on my local instance of SQL Server 2008 R2 (non express). However, it takes 38 seconds on an instance of Sql Server Express. It might just be the difference between a local 8gb Hyper-V machine and a remote GoGrid machine with half the memory.

My question is am I doing anything obviously inefficient here?

Query:

declare @FromTimestamp datetime = '2012-02-01'
declare @ToTimestamp datetime = '2012-02-22'
DECLARE @to datetime = DATEADD(dd, 1, @ToTimestamp)
SELECT
    Data.value('(/LendingTreeAffiliateRequest/Request/@AppID)[1]', 'varchar(50)') AS AppID,
    Data.value('(/LendingTreeAffiliateRequest/Request/@type)[1]', 'varchar(50)') AS [Type], 
    [Timestamp], 
    Data.value('(/LendingTreeAffiliateRequest/@affid)[1]', 'varchar(50)') AS CDNumber, 
    Data.value('(/LendingTreeAffiliateRequest/Request/SourceOfRequest/VisitorIPAddress)[1]', 'varchar(50)') AS IP, 
    Data.value('(/LendingTreeAffiliateRequest/Request/SourceOfRequest/LendingTreeAffiliateEsourceID)[1]', 'varchar(50)') AS ESourceID,
    Data.value('(/LendingTreeAffiliateRequest/Request/Applicant/State)[1]', 'char(2)') AS [State],
    Data.value('(/LendingTreeAffiliateRequest/Request/Applicant/DateOfBirth)[1]', 'varchar(20)') AS DateOfBirth,
    Data.value('(/LendingTreeAffiliateRequest/Request/Applicant/EmailAddress)[1]', 'varchar(255)') AS Email,
    Data.value('(/LendingTreeAffiliateRequest/Request/Applicant/IsVeteran)[1]', 'char(1)') AS IsVeteran,
    Data.value('(/LendingTreeAffiliateRequest/Request/Applicant/CreditHistory/CreditSelfRating)[1]', 'varchar(50)') AS Credit
FROM 
    WebLogEntry wle
    INNER JOIN EventType et on wle.EventTypeId=et.Id
    INNER JOIN [EventData] ed on wle.EventDataId=ed.Id
WHERE
    (et.Id=2)
        AND (Data.exist('/LendingTreeAffiliateRequest/Request/@AppID')=1)
        AND ([Timestamp] BETWEEN @FromTimestamp AND @to)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T08:08:30+00:00Added an answer on May 30, 2026 at 8:08 am

    I don’t see anything obviously wrong other than the fact that the SQL server is going to have to churn on an awful lot of xquery. You might want to try returning the data field in its entirety and then parse it in code to see if that is faster with your particular implementation. Measure the time of both methods and go with the faster one.

    If you have a predictable data structure, you are better off storing that in a table rather than XML blobs as that will speed things up significantly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this query that, due to the number of records, is taking several
I have this SQL Query that pulls data from 3 tables. I am unable
I am wondering. I have a complex query which runs in a SQL Server
I have a query that runs super fast when executed in the sql editor
I have this query that runs for over 3 minutes. I am looking to
I have this query that returns the results by ordering it by focus.name ASC.
I have this query that inserts rows, using a subquery like so: INSERT INTO
I have have this query that i want to execute. SELECT warehouse.expiry_date, pharmacy.expiry_date, drugs.active_substance,
So I have this query that works perfectly: SELECT users.*, GROUP_CONCAT(categories.category_name) AS categories FROM
I have this working query that outputs URL and click counts from database. <?php

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.