SQL
x
/*
A backend replacement for https://tools.wmflabs.org/grep/
The current implementation of grep is very slow.
But as I've discovered by experimenting with this query,
"REGEXP" is not paricularly fast on its own either.
"LIKE" is much faster for some reason.
*/
SET @regex_pattern = "^U\+.*";
SET @like_pattern = "C+%";
USE enwiki_p; /* "Language" and "Project" */
SELECT *
FROM page
WHERE
page_namespace = 0 /* Namespace */
AND page_title REGEXP @regex_pattern /* "Pattern" */
/* AND page_title LIKE @like_pattern /* More straightforward option for pattern-based searching */
/* AND NOT page_is_redirect - negate "Include redirects" */
/* LIMIT 100 /* "Limit the display to the first 100 results" */
By running queries you agree to the Cloud Services Terms of Use and you irrevocably agree to release your SQL under CC0 License.
All SQL code is licensed under CC0 License.