문제

I have a SELECT query which is using 6 Stored Functions. The Stored Functions are optimized and the query will run in 0.05 seconds when now ORDER BY is used. When I try to ORDER BY the query time drops to 15 seconds.

I tried to use temp tables and tables in memory, but creating these tables take still almost 15 seconds.

I tried to use a view, but then the SELECT with ORDER BY query is still slow.

Example of the query:

SELECT field1, fiedl2, field 3,  
    FUNC1(1, 2) AS score1,  
    FUNC2(1, 2) AS score2,  
    FUNC3(1, 2) AS score3,  
    FUNC4(1, 2) AS score4  
FROM table  
WHERE field1 = 1  
ORDER BY (score1 * 1 + score2 * 2 + score3 * 2 + score4 * 4) DESC;

Any help is welcome, thanks!

올바른 솔루션이 없습니다

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top