使用 image/varbinary 字段进行联合查询时出现的问题

发布于 2024-08-15 09:36:31 字数 698 浏览 3 评论 0原文

我在执行以下查询时遇到一些问题:

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

当我在没有联合的情况下单独运行每个查询时,它们会快速执行(<5秒),但是当我使用联合运行它时,它需要永远执行(事实上所有查询)说正在执行。我还没有看到它成功运行)

在 OtherDB.dbo.Signatures 中,签名字段是 varbinary(max) ,在 AppDB.dbo.Signatures 中,该字段是一个图像,这就是我使用转换表达式的原因。 有谁知道问题可能是什么以及我该如何解决它?

谢谢

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱格式化 2024-08-22 09:36:31

我想知道这是否是因为您使用的是 UNION 而不是 UNION ALL。 UNION 本身将删除数据集之间的重复行。这可能会导致您的 blob 字段出现延迟。使用 UNION ALL 看看是否有差异。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文