-
-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add index_advisor extension to image (#933)
* add index_advisor extension to image * bump image for testing on staging * remove -source from target COPY * add index_advisor to supautils allow list * bump image name for staging * update nix to include index_advisor + a smoke test * remove RC tag
- Loading branch information
Showing
8 changed files
with
97 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ lib, stdenv, fetchFromGitHub, postgresql }: | ||
|
||
stdenv.mkDerivation rec { | ||
pname = "index_advisor"; | ||
version = "0.2.0"; | ||
|
||
buildInputs = [ postgresql ]; | ||
|
||
src = fetchFromGitHub { | ||
owner = "olirice"; | ||
repo = pname; | ||
rev = "v${version}"; | ||
hash = "sha256-G0eQk2bY5CNPMeokN/nb05g03CuiplRf902YXFVQFbs="; | ||
}; | ||
|
||
installPhase = '' | ||
mkdir -p $out/{lib,share/postgresql/extension} | ||
cp *.sql $out/share/postgresql/extension | ||
cp *.control $out/share/postgresql/extension | ||
''; | ||
|
||
meta = with lib; { | ||
description = "Recommend indexes to improve query performance in PostgreSQL"; | ||
homepage = "https://github.com/olirice/index_advisor"; | ||
maintainers = with maintainers; [ samrose ]; | ||
platforms = postgresql.meta.platforms; | ||
license = licenses.postgresql; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
-- Start transaction and plan the tests. | ||
begin; | ||
select plan(1); | ||
|
||
create extension if not exists index_advisor; | ||
|
||
create table account( | ||
id int primary key, | ||
is_verified bool | ||
); | ||
|
||
select is( | ||
(select count(1) from index_advisor('select id from public.account where is_verified;'))::int, | ||
1, | ||
'index_advisor returns 1 row' | ||
); | ||
|
||
select * from finish(); | ||
rollback; |