English 中文(简体)
Problems with a Union Query with an image/varbinary field
原标题:

I m having some problems with the following Query:

SELECT  v.idnum
       ,v.full_name
       ,convert(varbinary(max),s.signature)  as Sig
FROM         AppDB.dbo.v_People1 AS v INNER JOIN
                      OtherDB.dbo.Signatures AS s ON v.idnum = s.idnum

UNION

SELECT  v.idnum
   , v.full_name
   , convert(varbinary(max), s.signature) as Sig
FROM         AppDB.dbo.v_People2 AS v INNER JOIN
                      AppDB.dbo.Signatures AS s ON v.idnum = s.idnum

When i run them each of the queries separately without the union they execute quickly (<5 seconds), but when i run it using the union it s taking forever to execute (infact all it says is executing. I haven t seen it run successfully)

In OtherDB.dbo.Signatures the signature field is a varbinary(max) and in AppDB.dbo.Signatures the field is an image which is why i am using the convert expression. Does anyone know what the problem might be and how i can go about fixing it?

Thanks

最佳回答

I wonder if it s because you are using a UNION instead of a UNION ALL. UNION by itself will remove duplicate rows between the data sets. This may be causing a delay on your blob field. See if there is a difference using UNION ALL.

问题回答

暂无回答




相关问题
What to look for in performance analyzer in VS 2008

What to look for in performance analyzer in VS 2008 I am using VS Team system and got the performance wizard and reports going. What benchmarks/process do I use? There is a lot of stuff in the ...

SQL Table Size And Query Performance

We have a number of items coming in from a web service; each item containing an unknown number of properties. We are storing them in a database with the following Schema. Items - ItemID - ...

How to speed up Visual Studio 2008? Add more resources?

I m using Visual Studio 2008 (with the latest service pack) I also have ReSharper 4.5 installed. ReSharper Code analysis/ scan is turned off. OS: Windows 7 Enterprise Edition It takes me a long time ...

Manually implementing high performance algorithms in .NET

As a learning experience I recently tried implementing Quicksort with 3 way partitioning in C#. Apart from needing to add an extra range check on the left/right variables before the recursive call, ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

热门标签