Smarter replacement checks for columns
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- sql
- Domain
- cli, databases, performance
Research direction
The issue names no files or tests; begin by tracing the search-replace command's column selection and SQL generation using the wp_posts example and its --skip-columns options. Done means the command can safely identify columns that do not need replacement while preserving expected replacements and improving the reported runtime.
Written by the indexing model from the issue text.
Description
Feature Request
- Yes, I reviewed the contribution guidelines.
Describe your use case and the problem you are facing
I have been actively trying to increase the velocity on my own URL S&Rs. To benchmark/diagnose how I could make them faster I started watching the SQL connections on large, test DBs with about 20gb worth of database rows living in wp_posts.
What I tended to notice are queries like the following:
UPDATE `wp_posts` SET `post_status` = REPLACE(`post_status`, 'http://dontmatter.co/', 'http://dontmatter.test/')
basically S&R is trying to replace on a column we can say confidently is not going to hold something I'd like to replace. One way around this is skipping these checks is to skip on this particular column. In my benchmarks case I skipped the following:
docker-compose run --rm wpcli wp search-replace --url=http://dontmatter.co/ 'http://dontmatter.co/' 'http://dontmatter.test/' wp_posts --recurse-objects --skip-columns=post_title,post_excerpt,post_status,comment_status,post_password,post_name,to_ping,pinged,guid,post_type,post_mime_type
a command that used to take me 32 minutes to execute now takes me 7 minutes with these changes.
Describe the solution you'd like
While I could do this for every single table in WP on my own, I feel this could be easier by being smarter about what columns we could skip automatically. Like we're never going to see something we'd like to replace on columns that act as binaries or columns that are like enums such as post_type that are all typed as varchar in the db.
- Dominant language
- Gherkin
- Stars
- 61
- Forks
- 47
- Avg merge
- 8m
- Merged PRs (30d)
- 1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from wp-cli/search-replace-command
-
bug command:search-replace scope:distribution state:unconfirmed
Difficulty 4/5 3-5 days Newbie friendliness 45/100
wp-cli/search-replace-command#231 · 5 comments ·
-
command:search-replace contributor-day
Difficulty 5/5 Over a week Newbie friendliness 25/100
wp-cli/search-replace-command#186 · 2 comments · 11 reactions ·
-
command:search-replace
Difficulty 4/5 3-5 days Newbie friendliness 35/100
wp-cli/search-replace-command#142 · 5 comments · 2 reactions ·
-
command:search-replace
Difficulty 3/5 1-2 days Newbie friendliness 52/100
wp-cli/search-replace-command#137 · 6 comments · 4 reactions ·
-
Progress bar Opencommand:search-replace
wp-cli/search-replace-command#134 · 1 comment · 6 reactions · 1 assignee ·
All issues in wp-cli/search-replace-command
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
qgis/QGIS-Documentation#11275 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
milvus-io/birdwatcher#545 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
area:tools bug good first issue help wanted priority:P2
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
TaewoooPark/Motifcode#14 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
newrelic-experimental/preflight#793 · 1 comment ·