Hi frenz, I have a problem of slow loading of distinct column values from table.Can i know the alternative way to load the data from database much faster. The query below is taking 1 and half minute to fetch data. Please suggest the right way. Thank you.
What I have tried:
SET @t1 = CONCAT('SELECT DISTINCT gender FROM ', tablename);
SET @t2 = CONCAT('SELECT DISTINCT country FROM ',tablename);
SET @t3 = CONCAT('SELECT DISTINCT DATE_FORMAT(date_time,\'%Y-%m-%d\') as date_time FROM ', tablename,' where source=','\'',sourceslist, '\'');
SET @t4 = CONCAT('SELECT DISTINCT product_name FROM ', tablename);
SET @t5 = CONCAT('SELECT DISTINCT source FROM ', tablename);
here table name takes the dynamic name which is containing more than 3800000 rows