Skip to content

postgresqlPackages.vectorchord: init at 0.4.2#392710

Merged
wolfgangwalther merged 3 commits into
NixOS:masterfrom
diogotcorreia:postgres-vectorchord
Jul 5, 2025
Merged

postgresqlPackages.vectorchord: init at 0.4.2#392710
wolfgangwalther merged 3 commits into
NixOS:masterfrom
diogotcorreia:postgres-vectorchord

Conversation

@diogotcorreia

Copy link
Copy Markdown
Member

Scalable, fast, and disk-friendly vector search in Postgres, the successor of pgvecto.rs.

https://github.com/tensorchord/VectorChord

Closes #392680

Probably going to be needed for Immich soon.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions Bot added the 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS label Mar 24, 2025
@github-actions github-actions Bot added 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. labels Mar 24, 2025
Comment thread pkgs/servers/sql/postgresql/ext/vectorchord/package.nix Outdated
Comment thread pkgs/servers/sql/postgresql/ext/vectorchord/package.nix Outdated
Comment thread pkgs/servers/sql/postgresql/ext/vectorchord/package.nix Outdated
Comment thread pkgs/servers/sql/postgresql/ext/vectorchord/package.nix Outdated
Comment thread pkgs/servers/sql/postgresql/ext/vectorchord/package.nix Outdated
Comment thread nixos/tests/postgresql/vectorchord.nix Outdated
Comment thread nixos/tests/postgresql/vectorchord.nix Outdated

@Titaniumtown Titaniumtown left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

diff LGTM besides the comments made by others. I think we should hold off merging this until an immich release actually uses this. Thanks for the proactive PR @diogotcorreia !

@github-actions github-actions Bot removed the 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS label Mar 24, 2025
@diogotcorreia

Copy link
Copy Markdown
Member Author

VectorChord 0.3.0 has been released, but there's a major blocker to updating. Many functions related to avx have been marked as safe in rust nightly, but are still unsafe on rust stable (even 1.86): rust-lang/stdarch#1714
Example:

My guess is that this would land on 1.87, which will be released in the 15th of May, and likely take a few weeks to hit master.

For now I think I'll wait until Immich moves to vectorchord, and then if Rust 1.87 is still not available on master at that time I'll make a patch to add unsafe blocks around these calls to unsafe functions.

If anyone has a better idea, I'd appreciate some guidance.

Related upstream commit: supervc-stack/VectorChord@dc12d84

@Ma27 Ma27 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I had this tab open for too long without paying attention. What's the status here?

Comment thread pkgs/servers/sql/postgresql/ext/vectorchord/package.nix Outdated
@diogotcorreia

diogotcorreia commented May 9, 2025

Copy link
Copy Markdown
Member Author

@Ma27 I think we're waiting for Immich to migrate before merging. However, considering what I wrote in my previous comment (#392710 (comment)), upgrading this to 0.3.0 would not be easy and would require extensive patching afaik (EDIT: it seems like the aforementioned changes will be in Rust 1.87, so if Immich doesn't upgrade in the next month or two it should be fine).

There have also been talks about handling dependencies between extensions (#392710 (comment)), but I've unfortunately not had much time to look into this

EDIT: I also realized I haven't updated this PR after #394089 has been merged, so I'll do that

@diogotcorreia

diogotcorreia commented May 9, 2025

Copy link
Copy Markdown
Member Author

Update: Immich is already working on this, so it might be released soon: immich-app/immich#18042
However, they mention that they will keep supporting pgvecto.rs for a while, so that's good news

@diogotcorreia diogotcorreia force-pushed the postgres-vectorchord branch from 2d149c7 to d33602c Compare May 9, 2025 14:39
@diogotcorreia

Copy link
Copy Markdown
Member Author

Rebased on master, refactored to use finalAttrs and added asserts to tests

@github-actions github-actions Bot added 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. and removed 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. labels May 9, 2025
@mertalev

Copy link
Copy Markdown

Immich dev here! Just a heads up that we plan to switch to VectorChord in a release this week, with 0.3.0 as the minimum supported version. We'll remove pgvecto.rs support later in the coming months, so it's recommended to switch when possible. That being said, pgvecto.rs will still work for now without any manual intervention, so it's okay if you can't make the switch right away.

@diogotcorreia

Copy link
Copy Markdown
Member Author

@mertalev Thanks a lot for the heads up! Rustc in nixpkgs has been updated to 1.87.0 in #407444, so we should be able to update this PR to 0.3.0 in the coming weeks, once the rustc update hits master.

We'll remove pgvecto.rs support later in the coming months

Do you have any estimate for how long you're going to support pgvecto.rs? Afaik rustc won't be updated in NixOS 25.05, so we won't be able to get vectorchord (without extensive patching like I mentioned in previous comments) in the NixOS stable channel until the end of November (for NixOS 25.11).

@mertalev

Copy link
Copy Markdown

The current plan is to remove pgvecto.rs support around the time of the stable release, which I'd say is unlikely to happen before August.

Would supporting VectorChord 0.2.2 make things easier for you?

@dotlambda

dotlambda commented May 20, 2025

Copy link
Copy Markdown
Member

Afaik rustc won't be updated in NixOS 25.05

Doing so wouldn't be a problem.

EDIT: I don't mean updating but adding a rust_1_78 attribute.

@diogotcorreia diogotcorreia left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 392710
Commit: 564ed3e9f89f768af9b1f6dcb956a1a4b099f1a5


x86_64-linux

✅ 7 packages built:
  • cargo-pgrx
  • cargo-pgrx_0_12_6
  • postgresql13Packages.vectorchord
  • postgresql14Packages.vectorchord
  • postgresql15Packages.vectorchord
  • postgresql16Packages.vectorchord
  • postgresql17Packages.vectorchord

@wolfgangwalther

Copy link
Copy Markdown
Contributor

Please rename the first commit to postgresqlPackages.{pgvectorscale,pgx_ulid}: .... This would allow ofborg to actually build it (not a rebuild, but anyway).

@wolfgangwalther

Copy link
Copy Markdown
Contributor

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 392710
Commit: 564ed3e9f89f768af9b1f6dcb956a1a4b099f1a5


x86_64-linux

✅ 6 packages built:
  • cargo-pgrx (cargo-pgrx_0_14_1)
  • postgresql13Packages.vectorchord
  • postgresql14Packages.vectorchord
  • postgresql15Packages.vectorchord
  • postgresql16Packages.vectorchord
  • postgresqlPackages.vectorchord (postgresql17Packages.vectorchord)

aarch64-linux

✅ 6 packages built:
  • cargo-pgrx (cargo-pgrx_0_14_1)
  • postgresql13Packages.vectorchord
  • postgresql14Packages.vectorchord
  • postgresql15Packages.vectorchord
  • postgresql16Packages.vectorchord
  • postgresqlPackages.vectorchord (postgresql17Packages.vectorchord)

x86_64-darwin

✅ 1 package built:
  • cargo-pgrx (cargo-pgrx_0_14_1)

aarch64-darwin

✅ 1 package built:
  • cargo-pgrx (cargo-pgrx_0_14_1)

@tecosaur

tecosaur commented Jul 1, 2025

Copy link
Copy Markdown
Contributor

Am I correct in thinking that this is the sole factor blocking an Immich update to 1.135?

@diogotcorreia

Copy link
Copy Markdown
Member Author

Am I correct in thinking that this is the sole factor blocking an Immich update to 1.135?

@tecosaur Hasn't Immich been updated a while ago already? #417977 #418220

Immich still supports pgvecto-rs, so this is not blocking anything at the moment (except PostgreSQL 17 support, since pgvecto-rs does not support that). They will deprecate support for it soon tho, so we should migrate sooner than later

@happysalada

Copy link
Copy Markdown
Contributor

@wolfgangwalther are you okay with merging this ?

You suggested an improvement which i think is good. Just thinking we can potentially keep it as a future improvement to integrate this change.

Does anyone else want to delay merging to look at it more ?

@wolfgangwalther wolfgangwalther left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blockers from my side, except for meta.platforms, I think.

Comment thread pkgs/servers/sql/postgresql/ext/vectorchord/package.nix Outdated
@diogotcorreia

Copy link
Copy Markdown
Member Author

@happysalada I'm not sure if the allocation issues have been fully discussed: #392710 (comment)

cc @dotlambda

@diogotcorreia diogotcorreia force-pushed the postgres-vectorchord branch from 54f182d to ab82f5a Compare July 2, 2025 12:37
@wolfgangwalther

Copy link
Copy Markdown
Contributor

I'm not sure if the allocation issues have been fully discussed: #392710 (comment)

Since the linked issue wasn't entirely clear about finding the root cause of this, given that the allocator is changed in the next version anyway and that all passthru tests pass on both linux platforms (see below), I'd say we're good here.


nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 392710 --package postgresql13Packages.vectorchord.tests --package postgresql14Packages.vectorchord.tests --package postgresql17Packages.vectorchord.tests --package postgresql16Packages.vectorchord.tests --package postgresql15Packages.vectorchord.tests
Commit: ab82f5a51158d05d8d713bfc6f4cbec0456f85eb


x86_64-linux

✅ 5 packages built:
  • postgresql13Packages.vectorchord.tests.extension
  • postgresql14Packages.vectorchord.tests.extension
  • postgresql15Packages.vectorchord.tests.extension
  • postgresql16Packages.vectorchord.tests.extension
  • postgresql17Packages.vectorchord.tests.extension

aarch64-linux

✅ 5 packages built:
  • postgresql13Packages.vectorchord.tests.extension
  • postgresql14Packages.vectorchord.tests.extension
  • postgresql15Packages.vectorchord.tests.extension
  • postgresql16Packages.vectorchord.tests.extension
  • postgresql17Packages.vectorchord.tests.extension

x86_64-darwin

⏩ 5 packages marked as broken and skipped:
  • postgresql13Packages.vectorchord.tests.extension
  • postgresql14Packages.vectorchord.tests.extension
  • postgresql15Packages.vectorchord.tests.extension
  • postgresql16Packages.vectorchord.tests.extension
  • postgresql17Packages.vectorchord.tests.extension

aarch64-darwin

⏩ 5 packages marked as broken and skipped:
  • postgresql13Packages.vectorchord.tests.extension
  • postgresql14Packages.vectorchord.tests.extension
  • postgresql15Packages.vectorchord.tests.extension
  • postgresql16Packages.vectorchord.tests.extension
  • postgresql17Packages.vectorchord.tests.extension

@wolfgangwalther wolfgangwalther merged commit 04b04de into NixOS:master Jul 5, 2025
26 of 27 checks passed
@diogotcorreia diogotcorreia deleted the postgres-vectorchord branch July 5, 2025 12:25
@dotlambda

Copy link
Copy Markdown
Member

Am I overlooking something or is there no PR yet moving the Immich module to vectorchord?

@diogotcorreia

Copy link
Copy Markdown
Member Author

@dotlambda correct, I belive no one has done that PR yet

@th3voic3

Copy link
Copy Markdown

For reference since I needed this to migrate from the docker version I have the following in my module:
services.postgresql = { extensions = ps: with ps; [pgvector vectorchord]; settings.shared_preload_libraries = ["vchord"]; };

@Scrumplex

Copy link
Copy Markdown
Member

I have opened a PR for supporting VectorChord in Immich. As it can do most of the migration automatically, this is mostly just some enablement and a test: #428568

@diogotcorreia

Copy link
Copy Markdown
Member Author

I kinda forgot, but it likely makes sense to do a backport of this, so that we can backport #428568 later

Will do that manually soon, since it requires adding rust_1_88 I believe

@diogotcorreia diogotcorreia added the 8.has: port to stable This PR already has a backport to the stable release. label Jul 29, 2025
diogotcorreia added a commit to diogotcorreia/nixpkgs that referenced this pull request Apr 20, 2026
With compound licenses[1] recently merged, we can now properly represent
dual licensed packages without affecting its non-free status.

See NixOS#392710 (comment)
[1]: NixOS#468378
siraben pushed a commit to siraben/nixpkgs that referenced this pull request Apr 20, 2026
With compound licenses[1] recently merged, we can now properly represent
dual licensed packages without affecting its non-free status.

See NixOS#392710 (comment)
[1]: NixOS#468378
aiwao pushed a commit to aiwao/nixpkgs that referenced this pull request Apr 23, 2026
With compound licenses[1] recently merged, we can now properly represent
dual licensed packages without affecting its non-free status.

See NixOS#392710 (comment)
[1]: NixOS#468378
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

8.has: port to stable This PR already has a backport to the stable release. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Package request: VectorChord