![]() Either method works, though the sql shell script selects the appropriate slice for you. The sql shell script is a wrapper around the mysql command. There are a variety of ways to access the databases.įrom the command line, a shell script exists that automatically selects the correct slice for you. Unfortunately there is no way to access the wikitext directly via MySQL replica databases. The last file is where you can find the definition of actor_revision table, for instance. The script that populates the alternative views can be found in maintain-views.py this script uses maintain-views.yaml to populate those views. For instance, actor_revision table only includes those actors that match a row in the revision table's rev_actor column. ![]() The alternative tables boost the queries not just using indexes they also do so by subsetting the original table. That last file is where you can learn, for instance, that an additional index called log_actor_deleted is being created on the logging table using log_actor, log_deleted columns. This script uses the definitions found in index-conf.yaml to generate those indexes. The script that creates and maintains the indexes used by the alternative views is called maintain_replica_indexes.py. There is also an ipblocks_ipindex view, but it’s unclear which columns it’s optimized for.Īlso see News/Actor storage changes on the Wiki Replicas for additional information about slow performance using the actor and/or comment tables If you utilize the listed columns in your queries (especially in WHERE clause or ORDER BY statement) it is recommended to use these alternative views. There are some alternative views in which the data from the underlying tables are redacted in a different way, so that the corresponding indices can be used. You can only access data from the public (redacted) databases marked as _p (eg: enwiki_p). Toolforge has exact replicas of Wikimedia's databases, however, certain information is restricted using MySQL views.įor example, the user table view does not show things like user_password or user_email to Toolforge users. User names use spaces, not underscores.Page titles use underscores and never include the namespace prefix.There are a few tricks to how data is stored in the various tables. A table of this information is available here: List meta_p.wiki. The slices are named with a leading 's' and a digit-for example s1, s2, etc.-followed by the internal domain name '.db.' (e.g. ![]() The various databases are stored in 'slices'. DESCRIBE table_name will show the available columns in a specific table. SHOW TABLES will show the available tables in a database. There are also two commands you can use to view the layout. This script is a full copy from this post by Robert de Bock.The database layout is available at mw:Manual:Database layout.Ī dump of the currently running database layouts can be found here. The resul will be like: MySQL username: root Mysql -u "$username" -p"$password" -NBe "OPTIMIZE TABLE $name " "$database" Mysql -u $username -p"$password" -NBe "SHOW TABLE STATUS " $database | while read name engine version rowformat rows avgrowlength datalength maxdatalength indexlength datafree autoincrement createtime updatetime checktime collation checksum createoptions comment doįragmentation=$(($datafree * 100 / $datalength))Įcho "$database.$name is $fragmentation% fragmented." Mysql -u $username -p"$password" -NBe "SHOW DATABASES " | grep -v 'lost+found' | while read database do To not cause a lock in every table, the script below shows and runs (if you want to list but not run, comment the line) only for tables that have fragmentation.Įcho -n "MySQL username: " read usernameĮcho -n "MySQL password: " stty -echo read password stty echo echo Run an Optimize Table solve the question.īUT, be careful! During the optimize the table stay locked (writing is not possible).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |