This query performs terribly.
create table PATIENT
(
status varchar (2),
notsure varchar (7),
lastName varchar (20),
firstName varchar (11),
gender varchar (1),
dob varchar (8),
HealthCardNum varchar (12),
healthCardversionNum varchar (2),
number varchar (8),
comments varchar (20),
streetAdressLine1 varchar (30),
city varchar (15),
province varchar (3),
postalCode varchar (6),
homePhone varchar (10),
workPhone varchar (10),
secondAddress varchar (81),
dunno varchar (49),
dunno1 varchar (4),
due varchar (8),
due2 varchar (8),
patKey2 varchar (3),
morepadding varchar (16),
flag varchar (1),
eor varchar (35),
tempPK char (14)
);
select * from PATIENT
where tempPK in(
select tempPK from PATIENT
group by tempPK
having count(tempPK) > 1
)
The table only has 12k rows and individually each one performs well. Moreover this is not a corelated subquery so the optimizer should ensure that it runs quickly.
|
Please download the latest package:
v2.1.122 optimizes IN, NOT IN, ALL, and ANY on subquery.
v2.1.122 provides universal table declaration for a series of tables with the same table structure. '?' represents any single character, and '*' represents a string of zero or more characters. For instance, create table "*.log" (...); create table [*a?b.*"] (...). Universal table declaration is only visible for the current connection, and isn't prior to any specific table declaration.
According to our test for your sql, it can fetch all rows in 2s for a patient table with 20k rows.
|
Thanks!
You guys have incredible response time and customer service.
|