Obje ararag.usp_EmbedQueue_Dequeue
Demo modu

rag.usp_EmbedQueue_Dequeue

yordam

DB-11 · değişiklik 11.10.2026 · Obje aramaya dön

İfadeler

7 ifade · 52.727 çalışma · toplam 267,1 sn
Sorgu (query_hash)ÇalışmaOrt. süre (ms) Ort. CPU (ms)Ort. okumaSüredeki pay
0x3E245355DE2FBFF5 9.343 10,1 10,0 859 %35,3
0x6D36EE0A2B15B16D 16.540 4,0 3,1 132 %25,1
0x3D924CAB8808081C 2.595 16,7 16,6 671 %16,2
0x66560D987E891315 2.557 13,0 12,9 875 %12,4
0x9C50810AE7F20CD3 14.036 1,6 0,6 24 %8,5
0x8DCD67E99351E436 5.099 1,2 1,2 81 %2,3
0x78A87A1C102838E6 2.557 0,2 0,2 54 %0,2

Bağımlılıklar

Doğrudan referanslar (sys.sql_expression_dependencies); dinamik SQL ve geç bağlanan adlar görünmeyebilir.
Tanım
CREATE   PROCEDURE rag.usp_EmbedQueue_Dequeue
    @BatchSize int, @LeaseSeconds int
AS
BEGIN
    SET NOCOUNT ON;
    SET XACT_ABORT ON;
    BEGIN TRAN;
    WITH c AS (
        SELECT TOP (@BatchSize) *
        FROM rag.EmbedQueue WITH (READPAST, UPDLOCK, ROWLOCK)
        WHERE Status = 'Queued' OR (Status = 'Running' AND LeaseUntilUtc < DBA.fn_Now())
        -- Vaka/KB önce: bekçi her gün binlerce profili kuyruğa alır, onaydan sonra gelen vaka onların ardında beklemesin
        ORDER BY CASE SourceType WHEN 'Profile' THEN 1 ELSE 0 END, QueueID
    )
    UPDATE c SET Status = 'Running', Attempt = Attempt + 1, LeaseUntilUtc = DATEADD(second, @LeaseSeconds, DBA.fn_Now())
    OUTPUT inserted.QueueID, inserted.SourceType, inserted.SourceRef, inserted.Attempt;
    COMMIT;
END;

Bu nesnenin analizleri

Kayıt yok

Bu nesne için analiz yok.