Timeline for Query optimization issue on view with RANK on DateTime for most recent rows
Current License: CC BY-SA 4.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 29, 2020 at 0:00 | history | tweeted | twitter.com/StackDBAs/status/1233542575845449734 | ||
Feb 28, 2020 at 8:37 | comment | added | Rebecca | If some customers have more than one row for the same category, then the top RN=1 is the most recent because DateCreated DESC. Older ones are ignored. RN>1 | |
Feb 27, 2020 at 11:47 | comment | added | Denis Rubashkin |
I talk about your view vw_SyncDataRecent . Partition by PK column makes all rows get rn=1 because each partition will have one row.
|
|
Feb 27, 2020 at 11:25 | comment | added | Rebecca | @DenisRubashkin I only want the most recent by customer and category. So the RN = 1 makes sure it only takes the TOP 1 from each category for each customer. So any older rows, for a given customer and given category are ignored. It's like doing TOP 1 across the set. | |
Feb 27, 2020 at 10:23 | comment | added | Denis Rubashkin |
PARTITION BY Id, CustomerId Aren't you get all your rows got rn=1?
|
|
Feb 27, 2020 at 10:01 | vote | accept | Rebecca | ||
Feb 27, 2020 at 9:16 | answer | added | Randi Vertongen | timeline score: 3 | |
Feb 27, 2020 at 9:11 | history | edited | Rebecca | CC BY-SA 4.0 |
added 593 characters in body
|
Feb 27, 2020 at 9:03 | history | edited | Rebecca | CC BY-SA 4.0 |
added 176 characters in body
|
Feb 27, 2020 at 8:54 | history | asked | Rebecca | CC BY-SA 4.0 |