Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong Estimated Number of Rows for All Executions #26131

Open
ninopg opened this issue Jan 4, 2025 · 0 comments
Open

Wrong Estimated Number of Rows for All Executions #26131

ninopg opened this issue Jan 4, 2025 · 0 comments

Comments

@ninopg
Copy link

ninopg commented Jan 4, 2025

Type: Bug

To reproduce the issue on AdventureWorks2019 database generate the estimated plan for these two queries:

  1. select p.* from Person.Person p where p.LastName = 'Chen'
  2. select p.* from Person.Person p where p.LastName = 'Chen' and p.PersonType = 'IN'

Both plans consist of a nested loop with an Index Seek + Key Lookup.

In query 2 the Key Lookup also includes a predicate to check PersonType = 'IN' on the other hand in query 1 the Key Lookup only retrieves fields for select p.*.

In query 1 execution plan Estimated Number of Rows Per Execution is 1 as expected.

In query 2 execution plan Estimated Number of Rows Per Execution is 98.8758 but in this case it refers to the total number of rows expected for all the 103 expected executions.

In graphical representation both for query 1 and query 2 the product of Estimated Number of Executions x Estimated Number of Rows Per Execution is displayed as number of rows returned by Key Lookup, but it seems for query 2 just Estimated Number of Rows Per Execution should be displayed.

Image

key-lookup-with-predicate.txt
key-lookup-no-predicate.txt

Azure Data Studio version: azuredatastudio 1.50.0 (49c73a8, 2024-11-17T22:25:36.863Z)
OS version: Darwin arm64 24.1.0
Restricted Mode: Yes
Preview Features: Enabled
Modes: Restricted

System Info
Item Value
CPUs Apple M1 Pro (10 x 2400)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 7, 10, 10
Memory (System) 32.00GB (0.09GB free)
Process Argv
Screen Reader no
VM 0%
Extensions (3)
Extension Author (truncated) Version
dacpac Mic 1.14.0
import Mic 1.6.1
profiler Mic 0.14.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant