<div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif">Thanks John. I avoided category table because it is not 100% consistent with categorylinks, but they join you used takes care of that. This is an excellent solution to my particular problem.<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 10, 2016 at 6:48 AM, John <span dir="ltr"><<a href="mailto:phoenixoverride@gmail.com" target="_blank">phoenixoverride@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Take a look at:<br><br> select * from category left join page on page_title = cat_title where page_namespace = 14 and cat_pages > 500 and 'fa' NOT IN (SELECT ll_lang FROM langlinks where ll_from = page_id)<br><div class="gmail_extra"><br></div><div class="gmail_extra">It works very quick and gives what you need.<br></div><div><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Mar 10, 2016 at 4:09 AM, Jaime Crespo <span dir="ltr"><<a href="mailto:jcrespo@wikimedia.org" target="_blank">jcrespo@wikimedia.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On Thu, Mar 10, 2016 at 9:24 AM, Purodha Blissenbach<br>
<<a href="mailto:purodha@blissenbach.org" target="_blank">purodha@blissenbach.org</a>> wrote:<br>
> I do not know how replication works, but I did and do assume, it<br>
> replicates indexes. If so, the online manual starting at<br>
> <a href="https://www.mediawiki.org/wiki/Manual:Database_layout" rel="noreferrer" target="_blank">https://www.mediawiki.org/wiki/Manual:Database_layout</a><br>
> may help you.<br>
<br>
</span>Correct. There are some cases where the indexing doesn't work (it<br>
doesn't make sense to use certain indexes that are partially filtered<br>
on the view). In those cases, new views are created, such as<br>
"revision_userindex", etc.<br>
<br>
Maybe we can add a "columns" table to information_schema_p, or the<br>
create tables to the "tables" table, where the original table<br>
description is explained. File a ticket if that would be useful.<br>
<br>
If there are several users that perform common slow analytics, file a<br>
ticket and we could, if technically possible, do them in advance so<br>
they do not have to be done every single time. Another option is to<br>
replicate to a column-based engine, but I am not sure if people would<br>
know how to take most advantage of those (where aggregations are<br>
cheap).<br>
<br>
> Shouldn't a simple join on indexed fields + a simple aggregation on an indexed field be relatively cheap<br>
<br>
No, aggregation on mysql, on standard engines, is never cheap. Indexes<br>
do not help with that, they still need to count every single row (so<br>
you are creating a filter, of a sort, of a full tablescan of one of<br>
the largest tables per wiki). Why doing that when the count is already<br>
aggregated?<br>
<br>
I recently delivered a session on query optimization for mysql and<br>
mariadb, using wikimedia and osm as examples [warning, external site]<br>
<<a href="https://github.com/jynus/query-optimization" rel="noreferrer" target="_blank">https://github.com/jynus/query-optimization</a>>, maybe that would be<br>
helpful?<br>
<span><br>
--<br>
Jaime Crespo<br>
<<a href="http://wikimedia.org" rel="noreferrer" target="_blank">http://wikimedia.org</a>><br>
<br>
</span><div><div>_______________________________________________<br>
Labs-l mailing list<br>
<a href="mailto:Labs-l@lists.wikimedia.org" target="_blank">Labs-l@lists.wikimedia.org</a><br>
<a href="https://lists.wikimedia.org/mailman/listinfo/labs-l" rel="noreferrer" target="_blank">https://lists.wikimedia.org/mailman/listinfo/labs-l</a><br>
</div></div></blockquote></div><br></div></div></div></div>
<br>_______________________________________________<br>
Labs-l mailing list<br>
<a href="mailto:Labs-l@lists.wikimedia.org">Labs-l@lists.wikimedia.org</a><br>
<a href="https://lists.wikimedia.org/mailman/listinfo/labs-l" rel="noreferrer" target="_blank">https://lists.wikimedia.org/mailman/listinfo/labs-l</a><br>
<br></blockquote></div><br></div>