ExpandedVenture / ConnectionSphere

Simple Service to Start Prospecting Online
0 stars 0 forks source link

Speed up the calculation of pending results + show the "calculation span" in the dashboard. #236

Open leandrosardi opened 2 years ago

leandrosardi commented 2 years ago

Related issues: leandrosardi/flywheel#648

Current time is 36 hours. Reduce such a time to 1-2.

Brainstorm where to show such an information.

USE euler;

SELECT DISTINCT s.id as sid, s.id_user, s.sync_stats_last_time, c.name, s.name, datediff(hh, s.sync_stats_last_time, getdate()) AS calculated_hours_ago
FROM search s WITH (NOLOCK) 
JOIN [user] u WITH (NOLOCK) ON u.id=s.id_user 
JOIN client c WITH (NOLOCK) ON ( c.id=u.id_client AND c.delete_time IS NULL ) 
JOIN v_flywheel_clients d ON d.id=c.id 
JOIN search_message x WITH (NOLOCK) ON s.id=x.id_search 
JOIN [message] m WITH (NOLOCK) ON (m.id=x.id_message AND ISNULL(m.status,0)=1 AND ISNULL(m.trigger_type,0)=0 AND m.delete_time IS NULL) 
WHERE s.delete_time IS NULL 
ORDER BY s.sync_stats_last_time ASC