as to get performance better ? | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

as to get performance better ?

en cuanto a consiga el funcionamiento mejor ? create table #solicitation
id int,
version tinyint,
PRIMARY KEY(id, version)
select * from #solicitation
insert into #solicitation values (1, 1, ‘onoonoonoono’)
insert into #solicitation values (1, 2, ‘onoonoonoonoA’)
insert into #solicitation values (1, 3, ‘onoonoonoonoB’)
insert into #solicitation values (2, 1, ‘bahbahbabhb’)
insert into #solicitation values (3, 1, ‘cororococo’)
insert into #solicitation values (4, 1, ‘biririri’)
insert into #solicitation values (4, 2, ‘piripipi’) seguro / certain
select *
from #solicitation a
where version = (select max(version) from #solicitation b where = error / mistake
select *
from #solicitation a
where exists (select max(version) from #solicitation b where =
(ad free)
I’m shure you can read English without problem, so I’ve moved to relevant forum.
Luis Martin
Moderator One of the symptoms of an approaching nervous breakdown is the belief that one’s work is terribly important
Bertrand Russell
All postings are provided “AS IS” with no warranties for accuracy.
The second query, with the EXISTS clause, looks for the answer to the question "What is maximum "version" for this id?"
Indeed a maximum value can be found for each id that you find in the table, so all rows are returned. There is no filtering because of this EXISTS clause. An EXISTS clause does a true/false evaluation. This can sometimes improve response times, but in this case it is of no help: you can only use a ‘simple’ subquery.