---
title: explain (StreamingQuery)
description: "StreamingQuery.explain method in PySpark: Prints the (logical and physical) plans to the console for debugging."
canonical_url: https://docs.databricks.com/gcp/en/pyspark/reference/classes/streamingquery/explain
---

# explain (StreamingQuery)

Prints the (logical and physical) plans to the console for debugging.

## Syntax

```
explain(extended=False)
```

## Parameters

| Parameter  | Type           | Description                                                                                                                       |
| ---------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| `extended` | bool, optional | If `False` (default), prints only the physical plan. If `True`, prints the parsed, analyzed, and optimized logical plans as well. |

## Returns

`None`

## Examples

```python
sdf = spark.readStream.format("rate").load()
sq = sdf.writeStream.format('memory').queryName('query_explain').start()
sq.processAllAvailable()
```

Print the physical plan only:

```python
sq.explain()
# == Physical Plan ==
# ...
```

Print all plans:

```python
sq.explain(True)
# == Parsed Logical Plan ==
# ...
# == Analyzed Logical Plan ==
# ...
# == Optimized Logical Plan ==
# ...
# == Physical Plan ==
# ...
sq.stop()
```
