Sample Header Ad - 728x90

Mysql UNION ALL query - Too slow using longtext

0 votes
0 answers
118 views
I have this query
select t.field1 from (
select t1.field1, t1.field2 from db1.table t1
UNION ALL 
select t2.field1, t2.field2 from db2.table t2
UNION ALL 
select t3.field1, t3.field2 from db3.table t3
) as t
field1 is a normal varchar(255) field, but field2 is a longtext field with > 3000 characters of data. If I am using this query > 20 sec, but if I am using without field2, this query < 2 sec. Theese tables have 100.000 rows but it will expand. What is the solution of this problem?
Asked by Eric H (1 rep)
Oct 15, 2022, 09:57 AM
Last activity: Oct 15, 2022, 10:05 AM