From: Tonkuma on
If you have a index for name column,
try
select DISTINCT
batch_id from tab1 t1
where exists
(select 1 from tab1 t2
where name LIKE 'A%'
and t1.batch_id = t2.batch_id)
;

or
select DISTINCT
batch_id from tab1
where name LIKE 'A%'
;