Smarter replacement checks for columns

Aperta
#194 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
sql

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

command:search-replace

Feature Request

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.

Lingua principale
Gherkin
Stelle
61
Fork
47
Merge medio
8m
PR unite (30g)
1

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di wp-cli/search-replace-command

Tutte le issue di wp-cli/search-replace-command

Issue simili

Altre issue su CLI

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.