# مقاييس وإحصائيات مفيدة

**URL:** https://meta.discourse.org/t/useful-metric-statics/106350
**Category:** Data & reporting
**Created:** [12 يناير 2019، 10:46ص UTC](https://meta.discourse.org/t/useful-metric-statics/106350 "2019-01-12T10:46:34Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![hhlp](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hhlp/32/124988_2.png) [@hhlp](https://meta.discourse.org/u/hhlp)
#### Post date: [12 يناير 2019، 10:46ص UTC](https://meta.discourse.org/t/useful-metric-statics/106350/1 "2019-01-12T10:46:34Z")

</div>

قرأتُ في مكان ما هنا في ديسكورد، لكن لا أستطيع العثور عليه الآن، منشورًا كتب فيه شخص مقياسًا مفيدًا/إحصائية باستخدام استعلام SQL… هناك بضعة منها، أود استخدام أحدها…

هل يمكنك إرشادي…

تحياتي.

---

<div class="post-metadata">

### Author: ![Johani](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/johani/32/176920_2.png) [@Johani](https://meta.discourse.org/u/Johani)
#### Post date: [12 يناير 2019، 12:49م UTC](https://meta.discourse.org/t/useful-metric-statics/106350/2 "2019-01-12T12:49:56Z")

</div>

There are a couple of topics that relate to this:

1. [Data explorer](https://meta.discourse.org/t/32566?silent=true) queries

> [@(Superseded) What cool data explorer queries have you come up with?](https://meta.discourse.org/t/what-cool-data-explorer-queries-have-you-come-up-with/43516):
>
> This topic became too long to be easily searched and has been broken down into separate topics. If you have any questions about how to write a [Data Explorer](https://meta.discourse.org/t/32566?silent=true) query, or have one to share, please start a new topic in the #Data & reporting category and tag it with the #sql-query tag. +1information_source For an alternative searchable list of queries that were in this topic, see @SidV’s [query list on GitHub](https://github.com/SidVal/discourse-data-explorer/blob/queries/querys.md).

1. Badge queries

> [@\[Superseded\] What cool badge queries have you come up with?](https://meta.discourse.org/t/what-cool-badge-queries-have-you-come-up-with/18978):
>
> warning Enabling Badge SQL entails security and performance risks so it is not available by default. For more information, see: [Enable Badge SQL](https://meta.discourse.org/t/badge-sql-can-no-longer-be-edited-by-default/47894) This topic became too long to be easily searched and has been broken down into separate topics. If you have any questions about how to write a badge query, or have one to share, please start a new topic in the #data & reporting category and tag it with the #sql-triggered-badge tag. +1 More ideas: [Some common badge queries](https://meta.discourse.org/t/some-common-badge-queries-idea/31859)

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [12 يناير 2019، 10:32م UTC](https://meta.discourse.org/t/useful-metric-statics/106350/3 "2019-01-12T22:32:36Z")

</div>

It is possible to enter the ruby console and run ActiveRecord queries, if you feel more comfortable doing that.

But IMHO, the best way is to use the [Data Explorer](https://meta.discourse.org/t/32566?silent=true) plugin.

- it provides information about tables, fields, and field datatypes
- it does only SELECT queries so it is inherently safer because it can not do anything destructive
- has built in LIMIT so a poorly crafted query will not bog or crash your site

Some knowledge of the database architecture is still needed, especially for complex queries. But many (IMHO, most) times it is intuitive. eg.  
it is clear that the posts table’s `posts.topic_id` field references the topics table’s `topics.id` field.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [11 فبراير 2019، 10:32م UTC](https://meta.discourse.org/t/useful-metric-statics/106350/4 "2019-02-11T22:32:38Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
