René's URL Explorer Experiment


Title: perf(postgres): Optimizing feast offline Store for date-range multi-FV retrieval by Vperiodt · Pull Request #6057 · feast-dev/feast · GitHub

Open Graph Title: perf(postgres): Optimizing feast offline Store for date-range multi-FV retrieval by Vperiodt · Pull Request #6057 · feast-dev/feast

X Title: perf(postgres): Optimizing feast offline Store for date-range multi-FV retrieval by Vperiodt · Pull Request #6057 · feast-dev/feast

Description: What this PR does / why we need it: Replaces the date-range multi-FV path in the Postgres offline store (previously base_entities + one LEFT JOIN LATERAL per feature view) with a set-based LOCF (Last Observation Carried Forward) implementation Uses a single timeline: stack (UNION ALL of spine + feature rows), COUNT for group boundaries, FIRST_VALUE for forward-fill, then filter to spine and apply per-FV TTL. Which issue(s) this PR fixes: Fixes slow get_historical_features on the Postgres offline store for date-range retrieval with multiple feature views. The LATERAL/inequality joins had O(N×M) cost. This PR switches to a LOCF path: one stacked timeline of size L, sort O(L log L), and O(L) window passes, which makes total cost as O(L log L). Misc Scenario: get_historical_features(features=[...], start_date=2023-01-01, end_date=2023-01-07) with no entity DataFrame and two feature views: driver_fv: entity driver_id, TTL 1 day, feature score customer_fv: entity customer_id, TTL 0, feature amount Inputs Parameter Value start_date 2023-01-01 end_date 2023-01-07 entity_df None (non-entity mode) FVs driver_fv (driver_id, score, TTL 1d), customer_fv (customer_id, amount, TTL 0) 1. Feature data window (__data_raw) Feature data is explicitly pulled from lookback to end_date so LOCF can carry the last observation before start_date. Time window used for feature data FV TTL Time window driver_fv 1 day [lookback_start_date, end_date] customer_fv 0 [start_date, end_date] With lookback_start_date = start_date - max_ttl (e.g. 2022-12-31 for 1-day TTL), driver_fv rows before 2023-01-01 are now included so LOCF can fill correctly. -- Per-FV __data_raw: feature rows from lookback_start_date..end_date "driver_fv__data_raw" AS ( SELECT "ts" AS event_timestamp, "driver_id", "score" AS "score" FROM "driver_table" AS sub WHERE "ts" BETWEEN '2023-01-01 00:00:00+00' - interval '1 day' AND '2023-01-07 00:00:00+00' ), "customer_fv__data_raw" AS ( SELECT "ts" AS event_timestamp, "customer_id", "amount" AS "amount" FROM "customer_table" AS sub WHERE "ts" BETWEEN '2023-01-01 00:00:00+00' AND '2023-01-07 00:00:00+00' ), 2. Spine: unified (entity, timestamp) grid Spine is built from each FV’s __data / __data_raw over [start_date, end_date]. When FVs have different entity sets, the template emits NULL AS "entity" for the FV that doesn’t have that entity: spine AS ( SELECT DISTINCT d.event_timestamp, d."driver_id", NULL AS "customer_id" FROM "driver_fv__data_raw" d WHERE d.event_timestamp BETWEEN '2023-01-01 00:00:00+00' AND '2023-01-07 00:00:00+00' UNION SELECT DISTINCT d.event_timestamp, NULL AS "driver_id", d."customer_id" FROM "customer_fv__data_raw" d WHERE d.event_timestamp BETWEEN '2023-01-01 00:00:00+00' AND '2023-01-07 00:00:00+00' ), Example spine shape ( Spine = distinct (event_timestamp, driver_id, customer_id) from both FVs; missing entity is NULL. event_timestamp driver_id customer_id 2023-01-01 00:00:00+00 101 NULL 2023-01-01 00:00:00+00 NULL 201 2023-01-02 00:00:00+00 101 NULL … … … 3. TTL in the final SELECT -- driver_fv has TTL 86400 (1 day) CASE WHEN (spine.event_timestamp - "driver_fv__f"."driver_fv__filled_ts") <= make_interval(secs => 86400) THEN "driver_fv__f"."score" ELSE NULL END AS "score", -- customer_fv has TTL 0: no CASE "customer_fv__f"."amount" AS "amount" Example final output shape After LOCF and TTL: one row per (event_timestamp, driver_id, customer_id); score is NULL when outside TTL. event_timestamp driver_id customer_id score amount 2023-01-01 00:00:00+00 101 NULL 0.8 NULL 2023-01-01 00:00:00+00 NULL 201 NULL 99.5 2023-01-02 00:00:00+00 101 NULL 0.9 NULL … … … … …

Open Graph Description: What this PR does / why we need it: Replaces the date-range multi-FV path in the Postgres offline store (previously base_entities + one LEFT JOIN LATERAL per feature view) with a set-based LOCF (...

X Description: What this PR does / why we need it: Replaces the date-range multi-FV path in the Postgres offline store (previously base_entities + one LEFT JOIN LATERAL per feature view) with a set-based LOCF (...

Opengraph URL: https://github.com/feast-dev/feast/pull/6057

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:f9822757-988d-74d5-daf0-71ee9fdbc680
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id8F5C:33952:1E59E2A:2979A84:6A4F2B39
html-safe-nonce92750aa747dd0ac9c6f78e9b0083396af07611853a9e8f15697566ce83fac195
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RjVDOjMzOTUyOjFFNTlFMkE6Mjk3OUE4NDo2QTRGMkIzOSIsInZpc2l0b3JfaWQiOiIzOTU2MTUzMjk2NDkwNTM5ODMzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacd7edaf1e95583c2ca510ab6453339e11ccb4868a297b60574224ca8507d9ca17
hovercard-subject-tagpull_request:3352082656
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/feast-dev/feast/pull/6057/files
twitter:imagehttps://avatars.githubusercontent.com/u/102902652?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/102902652?s=400&v=4
og:image:altWhat this PR does / why we need it: Replaces the date-range multi-FV path in the Postgres offline store (previously base_entities + one LEFT JOIN LATERAL per feature view) with a set-based LOCF (...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noneb92d11c0aa4a77d54ef4af1078b6a15fb5a70a215b30c4ecf28889d5a8e656d9
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/feast-dev/feast git https://github.com/feast-dev/feast.git
octolytics-dimension-user_id57027613
octolytics-dimension-user_loginfeast-dev
octolytics-dimension-repository_id161133770
octolytics-dimension-repository_nwofeast-dev/feast
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id161133770
octolytics-dimension-repository_network_root_nwofeast-dev/feast
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release2b8f23afb982271f1b22258a94aede67a6b77760
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/feast-dev/feast/pull/6057/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Ffeast-dev%2Ffeast%2Fpull%2F6057%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Ffeast-dev%2Ffeast%2Fpull%2F6057%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=feast-dev%2Ffeast
Reloadhttps://github.com/feast-dev/feast/pull/6057/files
Reloadhttps://github.com/feast-dev/feast/pull/6057/files
Reloadhttps://github.com/feast-dev/feast/pull/6057/files
Please reload this pagehttps://github.com/feast-dev/feast/pull/6057/files
feast-dev https://github.com/feast-dev
feasthttps://github.com/feast-dev/feast
Notifications https://github.com/login?return_to=%2Ffeast-dev%2Ffeast
Fork 1.4k https://github.com/login?return_to=%2Ffeast-dev%2Ffeast
Star 7.1k https://github.com/login?return_to=%2Ffeast-dev%2Ffeast
Code https://github.com/feast-dev/feast
Issues 212 https://github.com/feast-dev/feast/issues
Pull requests 172 https://github.com/feast-dev/feast/pulls
Discussions https://github.com/feast-dev/feast/discussions
Actions https://github.com/feast-dev/feast/actions
Security and quality 1 https://github.com/feast-dev/feast/security
Insights https://github.com/feast-dev/feast/pulse
Code https://github.com/feast-dev/feast
Issues https://github.com/feast-dev/feast/issues
Pull requests https://github.com/feast-dev/feast/pulls
Discussions https://github.com/feast-dev/feast/discussions
Actions https://github.com/feast-dev/feast/actions
Security and quality https://github.com/feast-dev/feast/security
Insights https://github.com/feast-dev/feast/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Ffeast-dev%2Ffeast%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Ffeast-dev%2Ffeast%2Fissues%2Fnew%2Fchoose
Vperiodthttps://github.com/Vperiodt
feast-dev:masterhttps://github.com/feast-dev/feast/tree/master
Vperiodt:patch-queryhttps://github.com/Vperiodt/feast/tree/patch-query
Conversation 28 https://github.com/feast-dev/feast/pull/6057
Commits 16 https://github.com/feast-dev/feast/pull/6057/commits
Checks 26 https://github.com/feast-dev/feast/pull/6057/checks
Files changed https://github.com/feast-dev/feast/pull/6057/files
Please reload this pagehttps://github.com/feast-dev/feast/pull/6057/files
perf(postgres): Optimizing feast offline Store for date-range multi-FV retrieval https://github.com/feast-dev/feast/pull/6057/files#top
Show all changes 16 commits https://github.com/feast-dev/feast/pull/6057/files
309cdac Optimizing Date-Range Queries Vperiodt Mar 4, 2026 https://github.com/feast-dev/feast/pull/6057/commits/309cdac14996e5ff1197fe4f1b84ecc33e24e751
3da5af3 fix issues Vperiodt Mar 4, 2026 https://github.com/feast-dev/feast/pull/6057/commits/3da5af3ec2491b63ca10533b0c7e2298cb3aba89
34eed9a fix lint Vperiodt Mar 4, 2026 https://github.com/feast-dev/feast/pull/6057/commits/34eed9aaab57416a36454bbe48a512cdd172740e
a4139b7 featureview entities Vperiodt Mar 9, 2026 https://github.com/feast-dev/feast/pull/6057/commits/a4139b7e665a1bd4fe83216929947909de977a57
74a474c fix LOCF spine UNION and empty-entity SQL Vperiodt Mar 9, 2026 https://github.com/feast-dev/feast/pull/6057/commits/74a474c94ff89d05e15bba7f47d2259a694307e6
6f754b8 added fixes Vperiodt Mar 16, 2026 https://github.com/feast-dev/feast/pull/6057/commits/6f754b84e4b301cef357dbfc478917343a0fc6ec
7594205 updates test Vperiodt Mar 16, 2026 https://github.com/feast-dev/feast/pull/6057/commits/7594205af5e408da5db61a3a9af4e3f3345cda73
f770c41 fix entity_df range Vperiodt Mar 16, 2026 https://github.com/feast-dev/feast/pull/6057/commits/f770c41c065651ba441287664d262fe41da5e973
f235eb8 updated postgres.py Vperiodt Mar 16, 2026 https://github.com/feast-dev/feast/pull/6057/commits/f235eb88987d32455fdd43b5ab11874ca40163f9
8c66e6f fix-lint Vperiodt Apr 10, 2026 https://github.com/feast-dev/feast/pull/6057/commits/8c66e6f74aaae6fe63cd6329d13607756ce9d435
25bc86d Merge branch 'feast-dev:master' into patch-query Vperiodt Apr 16, 2026 https://github.com/feast-dev/feast/pull/6057/commits/25bc86dc8efd1a80213492b18166b38f6baaab39
b6a4703 address reviews Vperiodt Apr 16, 2026 https://github.com/feast-dev/feast/pull/6057/commits/b6a4703379e7a71f4a2ccc6301834c82dfc3c911
d014b09 Merge branch 'feast-dev:master' into patch-query Vperiodt Apr 16, 2026 https://github.com/feast-dev/feast/pull/6057/commits/d014b09c60124452256a9c637f3be07c6ca25fd3
69565bb lint-fix Vperiodt Apr 16, 2026 https://github.com/feast-dev/feast/pull/6057/commits/69565bbe8bc79d49513f867f8cb9c5cae6e0e180
b5d7c8f Merge branch 'feast-dev:master' into patch-query Vperiodt Apr 17, 2026 https://github.com/feast-dev/feast/pull/6057/commits/b5d7c8f76e512c0c1338ce6bc943ca52c9aa390e
4db3b40 Merge branch 'master' into patch-query Vperiodt May 15, 2026 https://github.com/feast-dev/feast/pull/6057/commits/4db3b400d6afcc7612aefce44f11bf0f03949049
Clear filters https://github.com/feast-dev/feast/pull/6057/files
Please reload this pagehttps://github.com/feast-dev/feast/pull/6057/files
Please reload this pagehttps://github.com/feast-dev/feast/pull/6057/files
postgres.py https://github.com/feast-dev/feast/pull/6057/files#diff-a994d03a46cff3078563437b7f11cce95d7919665760e53f86a4cd5bad471c56
test_postgres.py https://github.com/feast-dev/feast/pull/6057/files#diff-a5a255620ee9fc4e7a42457ec896ced17a8323cf729ca8e2a6d9490732411eeb
https://github.com/feast-dev/feast/blob/master/CODEOWNERS#L10
sdk/python/feast/infra/offline_stores/contrib/postgres_offline_store/postgres.pyhttps://github.com/feast-dev/feast/pull/6057/files#diff-a994d03a46cff3078563437b7f11cce95d7919665760e53f86a4cd5bad471c56
View file https://github.com/feast-dev/feast/blob/4db3b400d6afcc7612aefce44f11bf0f03949049/sdk/python/feast/infra/offline_stores/contrib/postgres_offline_store/postgres.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/feast-dev/feast/pull/6057/{{ revealButtonHref }}
https://github.com/feast-dev/feast/pull/6057/files#diff-a994d03a46cff3078563437b7f11cce95d7919665760e53f86a4cd5bad471c56
https://github.com/feast-dev/feast/pull/6057/files#diff-a994d03a46cff3078563437b7f11cce95d7919665760e53f86a4cd5bad471c56
https://github.com/feast-dev/feast/pull/6057/files#diff-a994d03a46cff3078563437b7f11cce95d7919665760e53f86a4cd5bad471c56
jyejarehttps://github.com/jyejare
Apr 16, 2026https://github.com/feast-dev/feast/pull/6057/files#r3093314658
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/feast-dev/feast/pull/6057/files
https://github.com/feast-dev/feast/pull/6057/files#diff-a994d03a46cff3078563437b7f11cce95d7919665760e53f86a4cd5bad471c56
https://github.com/feast-dev/feast/pull/6057/files#diff-a994d03a46cff3078563437b7f11cce95d7919665760e53f86a4cd5bad471c56
https://github.com/feast-dev/feast/pull/6057/files#diff-a994d03a46cff3078563437b7f11cce95d7919665760e53f86a4cd5bad471c56
https://github.com/feast-dev/feast/pull/6057/files#diff-a994d03a46cff3078563437b7f11cce95d7919665760e53f86a4cd5bad471c56
https://github.com/feast-dev/feast/pull/6057/files#diff-a994d03a46cff3078563437b7f11cce95d7919665760e53f86a4cd5bad471c56
https://github.com/feast-dev/feast/pull/6057/files#diff-a994d03a46cff3078563437b7f11cce95d7919665760e53f86a4cd5bad471c56
https://github.com/feast-dev/feast/pull/6057/files#diff-a994d03a46cff3078563437b7f11cce95d7919665760e53f86a4cd5bad471c56
https://github.com/feast-dev/feast/pull/6057/files#diff-a994d03a46cff3078563437b7f11cce95d7919665760e53f86a4cd5bad471c56
YassinNouh21https://github.com/YassinNouh21
Mar 15, 2026https://github.com/feast-dev/feast/pull/6057/files#r2937031262
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/feast-dev/feast/pull/6057/files
Please reload this pagehttps://github.com/feast-dev/feast/pull/6057/files
Please reload this pagehttps://github.com/feast-dev/feast/pull/6057/files
YassinNouh21https://github.com/YassinNouh21
Mar 15, 2026https://github.com/feast-dev/feast/pull/6057/files#r2937031259
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/feast-dev/feast/pull/6057/files
https://github.com/feast-dev/feast/pull/6057/files#diff-a994d03a46cff3078563437b7f11cce95d7919665760e53f86a4cd5bad471c56
https://github.com/feast-dev/feast/pull/6057/files#diff-a994d03a46cff3078563437b7f11cce95d7919665760e53f86a4cd5bad471c56
https://github.com/feast-dev/feast/pull/6057/files#diff-a994d03a46cff3078563437b7f11cce95d7919665760e53f86a4cd5bad471c56
https://github.com/feast-dev/feast/pull/6057/files#diff-a994d03a46cff3078563437b7f11cce95d7919665760e53f86a4cd5bad471c56
Please reload this pagehttps://github.com/feast-dev/feast/pull/6057/files
Please reload this pagehttps://github.com/feast-dev/feast/pull/6057/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.