Skip to content

Instantly share code, notes, and snippets.

@chibaye
Forked from tsg/recipes.md
Created March 1, 2024 11:55
Show Gist options
  • Save chibaye/bb2ae6444e51647e3f3606e0f9d5b4cd to your computer and use it in GitHub Desktop.
Save chibaye/bb2ae6444e51647e3f3606e0f9d5b4cd to your computer and use it in GitHub Desktop.
Loading recipes for search testing

Testing

CREATE TABLE recipes(
	title text,
	ingredients text,
	directions text,
	link text,
	source text,
	ner text, 
	site text);
\COPY recipes(title, ingredients, directions, link, source, ner, site) 
   FROM 'recipes_data.csv' DELIMITER ',' CSV HEADER;
ALTER TABLE recipes ADD search tsvector GENERATED ALWAYS AS
 (to_tsvector('english', title) || 
  to_tsvector('english', ingredients) || 
  to_tsvector('english', directions)) STORED;
ALTER TABLE
Time: 506514.510 ms (08:26.515)
CREATE INDEX idx_recipes_search ON recipes USING GIN(search);
CREATE INDEX
Time: 129500.090 ms (02:09.500)
CREATE INDEX idx_recipes_title ON recipes (title);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment