Este contenido no está disponible en el idioma seleccionado
Trabajamos constantemente para que el contenido esté disponible en el idioma seleccionado. Gracias por tu paciencia.
Why is my query planning time so high in Amazon Redshift?
2 minutos de lectura
My query planning time in Amazon Redshift is longer than the execution time and I’m not sure why.
Queries with exclusive locks on a production load can increase the lock wait time. This increase causes your query planning time in Amazon Redshift to be much longer than the actual execution time. Check the Workload Execution Breakdown metric to see whether there's a sudden increase in query planning time. A transaction that's waiting for a lock likely caused the increase in time.
To detect a transaction that's waiting for a lock, complete the following steps:
Open a new session for your first lock:
begin; lock table1;
Open a second session that runs in parallel, and then run the following query:
select * from table1 limit 1000;
The query in this second session submits an AccessSharedLock request. Because the first session already claimed the AccessExclusiveLock, this second query must wait to access the lock. Then, the ExclusiveLock blocks all other operations on table1.
Check your Workload Execution Breakdown metrics. A sudden spike in query planning time can confirm that there's a transaction waiting for a lock.
(Optional) If a transaction waiting for a lock does exist, then manually terminate the session to release the lock: