Wikipedia:Request a query
Page for requesting database queries
From Wikipedia, the free encyclopedia
This is a page for requesting one-off database queries for certain criteria. Users who are interested and able to perform SQL queries on the projects can provide results from the Quarry website.
You may also be interested in the following:
- If you are interested in writing SQL queries or helping out here, visit our tips page.
- If you need to obtain a list of pages that meet certain criteria, consider using PetScan (user manual) or the default search. PetScan can generate lists of articles in subcategories, articles which transclude some template, etc.
- If you need to make changes to a number of articles based on a particular query, you can post to the bot requests page, depending on how many changes are needed.
- For long-term review and checking, database reports are available.
The database replicas do not have access to page content, so requests which require checking wikitext cannot be answered with database queries. In particular, there is no way to query for template parameters or anything related to references. However, someone may be able to assist by querying in another way (for example, checking for external links rather than references) or suggest an alternative tool.
About cleaning mass message lists of inactive users
Hey there, I would love it if someone could help me with a query that lists all of the users in a mass message list who have no edits or logged actions in 12 months. Ideally, it might also display the date of the last edit so the list can be sorted by that value. Thanks in advance, and let me know if you have any questions! —TechnoSquirrel69 (sigh) 04:19, 19 January 2026 (UTC)
- I can do it for lists that are in Category:MassMessage delivery lists, I suppose. MassMessage can use any page or category as its list of recipients, though, and plenty of the ones I see scrolling past on my watchlist aren't in that category (and don't have their content model set to Mass Message Delivery List either; I think that automatically puts them in the cat?). quarry:query/101151. And you're going to want to get wider consensus than "I personally think this might be a good idea" before you start removing names, too. —Cryptic 05:30, 19 January 2026 (UTC)
- Thanks, this is very helpful! I was only planning to clean out one list, not go on a spree with every list in existence. —TechnoSquirrel69 (sigh) 05:54, 19 January 2026 (UTC)
- Which? —Cryptic 06:12, 19 January 2026 (UTC)
- This one, which is related to an event I just organized (and future events I'm planning). —TechnoSquirrel69 (sigh) 15:47, 19 January 2026 (UTC)
- quarry:query/101175 specifically for that page. —Cryptic 16:05, 19 January 2026 (UTC)
- This one, which is related to an event I just organized (and future events I'm planning). —TechnoSquirrel69 (sigh) 15:47, 19 January 2026 (UTC)
- Which? —Cryptic 06:12, 19 January 2026 (UTC)
- Thanks, this is very helpful! I was only planning to clean out one list, not go on a spree with every list in existence. —TechnoSquirrel69 (sigh) 05:54, 19 January 2026 (UTC)
- How about doing things in reverse, and asking for any mass message list that has not been used in 18 months, and then targeting them for deletion. (I'm baffled to see MM lists specific do 2013-14 still on the books.) I'm aware of several people from other projects who subscribe to certain enwiki-only mass messages because they want to be aware of what's happening here; many actions here have an impact on other projects down the road. Risker (talk) 07:56, 19 January 2026 (UTC)
- quarry:query/101159 has all 544 by their last logged use. About 460 have gone unused for more than a year and a half. —Cryptic 09:20, 19 January 2026 (UTC)
- @TechnoSquirrel69, the Wikipedia:Feedback request service has a bot that removes inactive users. It could probably be adapted to do the same for other lists. WhatamIdoing (talk) 21:08, 4 February 2026 (UTC)
- I appreciate you for letting me know! Taking a closer look, it appears to be user-configurable by list, which is super nice. I know the current operators, so I'll talk to them about it and put it on the lists I'm using if appropriate. —TechnoSquirrel69 (sigh) 04:28, 5 February 2026 (UTC)
- You're welcome. I hope it proves useful to you. WhatamIdoing (talk) 04:34, 5 February 2026 (UTC)
- I appreciate you for letting me know! Taking a closer look, it appears to be user-configurable by list, which is super nice. I know the current operators, so I'll talk to them about it and put it on the lists I'm using if appropriate. —TechnoSquirrel69 (sigh) 04:28, 5 February 2026 (UTC)
Recreated Pages
Hey, would it be possible for somebody to help me with a query that lists all drafts that have been recreated from G5 deletions in the past 45 days or so? I don't know if this is possible but I'd greatly appreciate the help if it is. Thanks! --Seawolf35 T--C 02:34, 30 January 2026 (UTC)
- Recreated in the last 45 days, or deleted G5 in the last 45 days? —Cryptic 02:44, 30 January 2026 (UTC)
- And do you want pages that are currently redlinks, or just currently-existing ones? —Cryptic 02:45, 30 January 2026 (UTC)
- @Cryptic Just currently existing ones that have been recreated from G5 deletions. This is for sock hunting as it is painful to go through each and every deletion log manually from the page feed. --Seawolf35 T--C 02:48, 30 January 2026 (UTC)
- Hrm. Do you want pages that are currently in the draft namespace including pages created elsewhere and then moved to draft (for which I'd go by their earliest currently-not-deleted revision); or pages that were created in the draft namespace and might have been moved elsewhere since then? Only going to be looking at G5 deletions on draft titles either way. —Cryptic 03:00, 30 January 2026 (UTC)
- Cryptic: Could you do both? If not then pages created in the draft mainspace. --Seawolf35 T--C 03:03, 30 January 2026 (UTC)
- I think I misunderstood. Pages currently in the draft namespace. --Seawolf35 T--C 03:05, 30 January 2026 (UTC)
- quarry:query/101579. —Cryptic 03:12, 30 January 2026 (UTC)
- quarry:query/101580 for the other method, looking at the creation log. It finds less since it doesn't see that, for example, Draft:Caleb Alloway started at User:Intermezzo118/sandbox. —Cryptic 03:17, 30 January 2026 (UTC)
- I think I misunderstood. Pages currently in the draft namespace. --Seawolf35 T--C 03:05, 30 January 2026 (UTC)
- Cryptic: Could you do both? If not then pages created in the draft mainspace. --Seawolf35 T--C 03:03, 30 January 2026 (UTC)
- Hrm. Do you want pages that are currently in the draft namespace including pages created elsewhere and then moved to draft (for which I'd go by their earliest currently-not-deleted revision); or pages that were created in the draft namespace and might have been moved elsewhere since then? Only going to be looking at G5 deletions on draft titles either way. —Cryptic 03:00, 30 January 2026 (UTC)
- @Cryptic Just currently existing ones that have been recreated from G5 deletions. This is for sock hunting as it is painful to go through each and every deletion log manually from the page feed. --Seawolf35 T--C 02:48, 30 January 2026 (UTC)
- And do you want pages that are currently redlinks, or just currently-existing ones? —Cryptic 02:45, 30 January 2026 (UTC)
Articles created by new users
Hi, would it be possible to obtain over a sample period of 1 Jan 2026 to 28 Feb 2026:
- The number of articles created in mainspace (excluding redirects)
- The % of articles created in mainspace (excluding redirects) by users who had less than 100 edits
- The % of articles created in mainspace (excluding redirects) by users who had less than 100 edits
- The % of articles created in mainspace (excluding redirects) during the sample period t of article creations by editors with less than 100 edits that are tagged as a mobile edit on their first revision
Thanks. Kudpung กุดผึ้ง (talk) 14:54, 9 March 2026 (UTC)
- Finding out how many edits a user had at some time in the past is hard. In bulk, it's effectively impossible. I can look for new articles created by users who now have under 100 edits, but that's a very different set even over a two month period. And I suspect this is going to be dwarfed by the number of new pages created in draft anyway. —Cryptic 00:17, 11 March 2026 (UTC)
- Would it help to reduce the sample period to 30 days, from the last 30 days for example? For this exercise I'm not interested in drafts, only new pages that are created directly in mainspace or moved there from a user draft or sandbox. Kudpung กุดผึ้ง (talk) 11:12, 11 March 2026 (UTC)
- Still isn't going to be what you asked for, but will be a bit closer, at least.You're asking for pages currently in mainspace, created in the last 30 days, now? That's different, and somewhat harder, then created directly in mainspace (and maybe deleted or somewhere else now). Original request - or at least how I read it - was basically searching Special:Log/create; this is the equivalent of looking at each recently-edited mainspace page's history, so wouldn't be able to find anything that wouldn't. —Cryptic 19:54, 11 March 2026 (UTC)
- I didn't think it would make it harder, quite to the contrary in fact, but I do not understand the technology involved in such datamining. To reinforce an upcoming presentation I still need some basic stats. How about simply: The % of articles created in mainspace (excluding redirects) in the last 30 days by editors who still have less than 100 edits Kudpung กุดผึ้ง (talk) 00:42, 12 March 2026 (UTC)
- Still isn't going to be what you asked for, but will be a bit closer, at least.You're asking for pages currently in mainspace, created in the last 30 days, now? That's different, and somewhat harder, then created directly in mainspace (and maybe deleted or somewhere else now). Original request - or at least how I read it - was basically searching Special:Log/create; this is the equivalent of looking at each recently-edited mainspace page's history, so wouldn't be able to find anything that wouldn't. —Cryptic 19:54, 11 March 2026 (UTC)
- Would it help to reduce the sample period to 30 days, from the last 30 days for example? For this exercise I'm not interested in drafts, only new pages that are created directly in mainspace or moved there from a user draft or sandbox. Kudpung กุดผึ้ง (talk) 11:12, 11 March 2026 (UTC)
- 116381 creations; of those, 40379 nonredirects; of those, 3066 (7.59%) nonredirects by users with fewer than 100 edits and 505 (1.25%) nonredirects by mobile edits by users with fewer than 100 edits. Some other combinations of those criteria in the query. —Cryptic 03:59, 12 March 2026 (UTC)
AfC submissions by user class
Recently, I opened a discussion in WP:VPIL regarding restrictions on who can make drafts. I believe some statistics on how many drafts are submitted by TAs and unconfirmed accounts may help me. If it is possible, could anyone find the amount of drafts currently awaiting review by user class? CabinetCavers----DEPOSIT OPINION, [valued customer] 15:28, 11 March 2026 (UTC)
- RecentChanges shows about 200 still-extant Draft: pages created by TAs during the last week. This will not include any that have been deleted or that have been moved to the mainspace. The same filter for (still?) non-autoconfirmed editors finds about 800 article creations, and around 450 for editors who have made 10–500 edits, and 500 for experienced editors. Adding it up, we're looking at about 2,000 new pages in the Draft: space (not counting those already deleted or moved to the mainspace) per week, of which about 10% are from TAs and 40% from newcomers. That should give you a general idea of what a proper query would be likely to find (e.g., couple thousand articles per week, TAs are a small but non-trivial minority, etc.).
- One of the things that would be interesting to know is whether that has changed since the introduction of TAs. For example, is March 2026 different from March 2025? WhatamIdoing (talk) 17:46, 11 March 2026 (UTC)
- The creation log will show pages even if they've been deleted, and will show where they were created as opposed to where they are now. The onwiki interface doesn't have any way to filter by namespace or creator, though.But neither of those is relevant for drafts-awaiting-review, which is different from just "in the draft namespace" - it can include userspace drafts, and of course there's lots of unsubmitted and already-reviewed submissions in Draft:. Finding out who actually pushed the submit button is nontrivial, but who created the draft is easy. quarry:query/103016. Like the section above, this uses the accounts' current edit count, not the count when the draft was created; it does compare the accounts' registration times to the drafts' creation times correctly. —Cryptic 19:49, 11 March 2026 (UTC)
- So: of the current drafts awaiting AFC attention, 7% were created by IPs/TAs, 27% were from (current) newbies, 51% were from (now) autoconfirmed editors, and 15% are from (now) extended confirmed. WhatamIdoing (talk) 20:11, 11 March 2026 (UTC)
- The creation log will show pages even if they've been deleted, and will show where they were created as opposed to where they are now. The onwiki interface doesn't have any way to filter by namespace or creator, though.But neither of those is relevant for drafts-awaiting-review, which is different from just "in the draft namespace" - it can include userspace drafts, and of course there's lots of unsubmitted and already-reviewed submissions in Draft:. Finding out who actually pushed the submit button is nontrivial, but who created the draft is easy. quarry:query/103016. Like the section above, this uses the accounts' current edit count, not the count when the draft was created; it does compare the accounts' registration times to the drafts' creation times correctly. —Cryptic 19:49, 11 March 2026 (UTC)