Skip to content

Instantly share code, notes, and snippets.

View luis-alves's full-sized avatar

Luis Alves luis-alves

  • Portugal
View GitHub Profile
@luis-alves
luis-alves / psql_useful_stat_queries.sql
Created March 10, 2021 15:23 — forked from anvk/psql_useful_stat_queries.sql
List of some useful Stat Queries for PSQL
--- PSQL queries which also duplicated from https://github.com/anvk/AwesomePSQLList/blob/master/README.md
--- some of them taken from https://www.slideshare.net/alexeylesovsky/deep-dive-into-postgresql-statistics-54594192
-- I'm not an expert in PSQL. Just a developer who is trying to accumulate useful stat queries which could potentially explain problems in your Postgres DB.
------------
-- Basics --
------------
-- Get indexes of tables
{
"contest": [
{
"name": "string",
"position": "int",
"points": "int",
"statistics": {
"totalBets": {
"total": "int",
"won": "int",
def recurPower(base, exp):
if exp == 0:
print 1
elif exp < 2:
return 0
elif exp >= 2:
return base * recurPower(base, exp - 1)
else:
print base