# COUNT(\*)

Published articles for COUNT(\*).

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## "Regex for Rows": Simplifying Pattern Detection in SQL with MATCH\_RECOGNIZE

DevFeed: ["Regex for Rows": Simplifying Pattern Detection in SQL with MATCH\_RECOGNIZE](<https://devfeed.tech/articles/regex-for-rows-simplifying-pattern-detection-in-sql-with-match-recognize-31401.md>)

Original publisher: [Read original article](<https://www.databricks.com/blog/regex-rows-simplifying-pattern-detection-sql-matchrecognize>)

Author: Kent Marten; Sergei Fedorov

Published: 2026-09-16T17:14:05Z

Content type: tutorial

Language: en

Sources: [Databricks](<https://devfeed.tech/sources/databricks.md>)

Topics: [SQL](<https://devfeed.tech/topics/sql.md>), [databricks](<https://devfeed.tech/topics/databricks.md>), [Cybersecurity](<https://devfeed.tech/topics/cybersecurity.md>), [Security & Privacy](<https://devfeed.tech/topics/security-privacy.md>)

Tags: [count](<https://devfeed.tech/tags/count.md>), [cybersecurity](<https://devfeed.tech/tags/cybersecurity.md>), [databricks](<https://devfeed.tech/tags/databricks.md>), [failed](<https://devfeed.tech/tags/failed.md>), [false-positives](<https://devfeed.tech/tags/false-positives.md>), [functions](<https://devfeed.tech/tags/functions.md>), [login](<https://devfeed.tech/tags/login.md>), [partition](<https://devfeed.tech/tags/partition.md>), [product](<https://devfeed.tech/tags/product.md>), [real-time](<https://devfeed.tech/tags/real-time.md>), [regex](<https://devfeed.tech/tags/regex.md>), [sql](<https://devfeed.tech/tags/sql.md>), [window-functions](<https://devfeed.tech/tags/window-functions.md>)

### AI overview

This tutorial explains how Databricks supports SQL MATCH_RECOGNIZE for detecting ordered event patterns. It shows how the clause can simplify sequence detection, including identifying repeated login failures followed by a successful login, compared with complex SQL queries and window functions.

### Source excerpt

Imagine you work in cybersecurity and you have a table that tracks login attempts...

## Dogfooding the Billable Actions metric: How granular observability improved our metering validation

DevFeed: [Dogfooding the Billable Actions metric: How granular observability improved our metering validation](<https://devfeed.tech/articles/dogfooding-the-billable-actions-metric-how-granular-observability-improved-our-metering-validation-35778.md>)

Original publisher: [Read original article](<https://temporal.io/blog/dogfooding-the-billable-actions-metric-how-granular-observability-improved-our-metering-validation>)

Author: Eric Chen

Published: 2026-06-25T00:00:00Z

Content type: article

Language: en

Sources: [Temporal Blog](<https://devfeed.tech/sources/temporal-blog.md>)

Topics: [observability](<https://devfeed.tech/topics/observability.md>), [dashboards](<https://devfeed.tech/topics/dashboards.md>), [Cloud](<https://devfeed.tech/topics/cloud.md>), [API](<https://devfeed.tech/topics/api.md>), [Server](<https://devfeed.tech/topics/server.md>), [Time Series](<https://devfeed.tech/topics/time-series.md>), [benchmarking](<https://devfeed.tech/topics/benchmarking.md>)

Tags: [account](<https://devfeed.tech/tags/account.md>), [api](<https://devfeed.tech/tags/api.md>), [cloud](<https://devfeed.tech/tags/cloud.md>), [cost](<https://devfeed.tech/tags/cost.md>), [count](<https://devfeed.tech/tags/count.md>), [dashboard](<https://devfeed.tech/tags/dashboard.md>), [dashboards](<https://devfeed.tech/tags/dashboards.md>), [dogfooding](<https://devfeed.tech/tags/dogfooding.md>), [metric](<https://devfeed.tech/tags/metric.md>), [observability](<https://devfeed.tech/tags/observability.md>), [optimization](<https://devfeed.tech/tags/optimization.md>), [query](<https://devfeed.tech/tags/query.md>), [raw](<https://devfeed.tech/tags/raw.md>), [server](<https://devfeed.tech/tags/server.md>), [temporal-voices](<https://devfeed.tech/tags/temporal-voices.md>), [time-series](<https://devfeed.tech/tags/time-series.md>), [validation](<https://devfeed.tech/tags/validation.md>), [visibility](<https://devfeed.tech/tags/visibility.md>)

### AI overview

Temporal describes how its Billable Actions metric and OpenMetrics per-type breakdowns provide more granular cost visibility. Internally, the company uses the metric with a canary account and validation dashboards to verify metering accuracy, troubleshoot discrepancies, and identify optimization opportunities.

### Source excerpt

See how Temporal uses the Billable Actions metric internally to validate metering, troubleshoot discrepancies, and improve cost observability.

## The 2025 AI + Data Engineering Roadmap

DevFeed: [The 2025 AI + Data Engineering Roadmap](<https://devfeed.tech/articles/the-2025-ai-data-engineering-roadmap-27255.md>)

Original publisher: [Read original article](<https://blog.dataexpert.io/p/the-2025-breaking-into-data-engineering-roadmap>)

Author: Zach Wilson

Published: 2025-10-17T22:35:45Z

Content type: tutorial

Language: en

Sources: [DataExpert.io Newsletter](<https://devfeed.tech/sources/dataexpert-io-newsletter.md>)

Topics: [data-engineering](<https://devfeed.tech/topics/data-engineering.md>), [Python](<https://devfeed.tech/topics/python.md>), [SQL](<https://devfeed.tech/topics/sql.md>), [Artificial Intelligence](<https://devfeed.tech/topics/ai.md>), [airflow](<https://devfeed.tech/topics/airflow.md>), [BigQuery](<https://devfeed.tech/topics/bigquery.md>), [Orchestration](<https://devfeed.tech/topics/orchestration.md>), [Apache Spark](<https://devfeed.tech/topics/spark.md>), [data-modeling](<https://devfeed.tech/topics/data-modeling.md>), [Data Quality](<https://devfeed.tech/topics/data-quality.md>), [Embeddings](<https://devfeed.tech/topics/embeddings.md>), [Retrieval Augmented Generation (RAG)](<https://devfeed.tech/topics/retrieval-augmented-generation-rag.md>)

Tags: [2025](<https://devfeed.tech/tags/2025.md>), [ai](<https://devfeed.tech/tags/ai.md>), [airflow](<https://devfeed.tech/tags/airflow.md>), [bigquery](<https://devfeed.tech/tags/bigquery.md>), [count](<https://devfeed.tech/tags/count.md>), [course](<https://devfeed.tech/tags/course.md>), [data-engineering](<https://devfeed.tech/tags/data-engineering.md>), [data-modeling](<https://devfeed.tech/tags/data-modeling.md>), [data-quality](<https://devfeed.tech/tags/data-quality.md>), [embeddings](<https://devfeed.tech/tags/embeddings.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [framer](<https://devfeed.tech/tags/framer.md>), [newsletter](<https://devfeed.tech/tags/newsletter.md>), [orchestration](<https://devfeed.tech/tags/orchestration.md>), [python](<https://devfeed.tech/tags/python.md>), [rag](<https://devfeed.tech/tags/rag.md>), [real-time](<https://devfeed.tech/tags/real-time.md>), [right-join](<https://devfeed.tech/tags/right-join.md>), [spark](<https://devfeed.tech/tags/spark.md>), [sql](<https://devfeed.tech/tags/sql.md>)

### AI overview

A 2025 roadmap for entering data engineering, covering foundational SQL and Python skills, distributed computing, orchestration, data modeling, data quality, AI and data integrations, portfolio projects, and personal branding.

### Source excerpt

Getting a data engineering job is complicated.

## An Efficient Way to Check for Existence of Multiple Values in SQL

DevFeed: [An Efficient Way to Check for Existence of Multiple Values in SQL](<https://devfeed.tech/articles/an-efficient-way-to-check-for-existence-of-multiple-values-in-sql-28931.md>)

Original publisher: [Read original article](<https://blog.jooq.org/an-efficient-way-to-check-for-existence-of-multiple-values-in-sql/>)

Author: lukaseder

Published: 2024-02-16T14:16:45Z

Content type: tutorial

Language: en

Sources: [jOOQ](<https://devfeed.tech/sources/jooq.md>)

Topics: [SQL](<https://devfeed.tech/topics/sql.md>), [Benchmark](<https://devfeed.tech/topics/benchmark.md>), [Oracle Database](<https://devfeed.tech/topics/oracle-database.md>), [PostgreSQL](<https://devfeed.tech/topics/postgresql.md>)

Tags: [benchmark](<https://devfeed.tech/tags/benchmark.md>), [benchmarking](<https://devfeed.tech/tags/benchmarking.md>), [compare](<https://devfeed.tech/tags/compare.md>), [count](<https://devfeed.tech/tags/count.md>), [database](<https://devfeed.tech/tags/database.md>), [derived-table](<https://devfeed.tech/tags/derived-table.md>), [execution](<https://devfeed.tech/tags/execution.md>), [exists](<https://devfeed.tech/tags/exists.md>), [join](<https://devfeed.tech/tags/join.md>), [limit](<https://devfeed.tech/tags/limit.md>), [mysql](<https://devfeed.tech/tags/mysql.md>), [oracle](<https://devfeed.tech/tags/oracle.md>), [oracle-23c](<https://devfeed.tech/tags/oracle-23c.md>), [performance](<https://devfeed.tech/tags/performance.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [rdbms](<https://devfeed.tech/tags/rdbms.md>), [sql](<https://devfeed.tech/tags/sql.md>), [sql-performance](<https://devfeed.tech/tags/sql-performance.md>), [sql-server](<https://devfeed.tech/tags/sql-server.md>), [sql-syntax](<https://devfeed.tech/tags/sql-syntax.md>), [top](<https://devfeed.tech/tags/top.md>)

### AI overview

This article explains how to check whether multiple matching rows exist in SQL. It recommends limiting rows in a derived table before counting them, then compares execution plans and benchmark results for PostgreSQL 15 and Oracle 23c.

### Source excerpt

In a previous blog post, we've advertised the use of SQL EXISTS rather than COUNT(*) to check for existence of a value in SQL. I.e. to check if in the Sakila database, actors called WAHLBERG have played in any films, instead of: Do this: (Depending on your dialect you may require a FROM DUAL clause, ... Continue reading An Efficient Way to Check for Existence of Multiple Values in SQL ->

## Converting from MySQL to Postgres using NMIG

DevFeed: [Converting from MySQL to Postgres using NMIG](<https://devfeed.tech/articles/converting-from-mysql-to-postgres-using-nmig-28201.md>)

Original publisher: [Read original article](<http://fuzzyblog.io/blog/mysql/2020/09/22/converting-from-mysql-to-postgres-using-nmig.html>)

Author: Fuzzygroup

Published: 2020-09-22T00:11:00Z

Content type: tutorial

Language: en

Sources: [Scott Johnson](<https://devfeed.tech/sources/scott-johnson.md>)

Topics: [MySQL](<https://devfeed.tech/topics/mysql.md>), [Databases](<https://devfeed.tech/topics/databases.md>), [npm](<https://devfeed.tech/topics/npm.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>), [TypeScript](<https://devfeed.tech/topics/typescript.md>), [Git](<https://devfeed.tech/topics/git.md>)

Tags: [config](<https://devfeed.tech/tags/config.md>), [conversion](<https://devfeed.tech/tags/conversion.md>), [count](<https://devfeed.tech/tags/count.md>), [database](<https://devfeed.tech/tags/database.md>), [git](<https://devfeed.tech/tags/git.md>), [installation](<https://devfeed.tech/tags/installation.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [logs](<https://devfeed.tech/tags/logs.md>), [mysql](<https://devfeed.tech/tags/mysql.md>), [npm](<https://devfeed.tech/tags/npm.md>), [postgres](<https://devfeed.tech/tags/postgres.md>), [typescript](<https://devfeed.tech/tags/typescript.md>)

### AI overview

A practical guide to migrating a MySQL database to Postgres using the NMIG NPM tool. It covers installation, configuration, building the TypeScript code, running the conversion, and comparing row counts before and after migration.

### Source excerpt

Historically I've been a MySQL advocate but I've recently been quite impressed with Postgres. This leaves me in the position of needing to migrate several MySQL databases over to Postgres -or- run two database engines in production. And, clearly, it is far more desirable to run only a single production database server. I recently found the NPM tool NMIG and used it to successfully convert a MySQL database over to Postgres quickly and easily - once I got past the initial installation process. Installing and Using NMIG Here's what you need to do to use NMIG. Pro Tip 2: Go into your source database before you start the conversion and do a count on any table with a large number of records. This gives you a checksum on the overall process (NMIG has great logs but I always prefer belt and suspenders when it comes to working with valuable data). On your machine you need to have a version of NPM installed that is version 10 or later. Git clone the NMIG repo to a directory on your computer. Change into that directory. Edit the file config/config.json and set the credentials for your source and target. Make a directory named nmig_logs. Run npm install to install all the dependencies. Run npm run build to convert the code from TypeScript to JavaScript. Run the process with a syntax like this: npm start - -conf-dir='/Users/sjohnson/Sync/coding/my_x_is_y/nmig/config' -logs-dir='/Users/sjohnson/Sync/coding/my_x_is_y/nmig/nmig_logs' Note: Obviously you need to update your directories as needed. Pro Tip 2: Go into your target database after the conversion and do a count on the same table and compare the results with the above.

## Understand GROUP BY in Django ORM with SQL

DevFeed: [Understand GROUP BY in Django ORM with SQL](<https://devfeed.tech/articles/understand-group-by-in-django-with-sql-33896.md>)

Original publisher: [Read original article](<https://hakibenita.com/django-group-by-sql>)

Author: Haki Benita

Published: 2020-02-10T22:00:00Z

Content type: tutorial

Language: en

Sources: [Haki Benita](<https://devfeed.tech/sources/haki-benita.md>)

Topics: [Django](<https://devfeed.tech/topics/django.md>), [Object-relational mapping](<https://devfeed.tech/topics/orm.md>), [SQL](<https://devfeed.tech/topics/sql.md>), [Tutorial](<https://devfeed.tech/topics/tutorial.md>)

Tags: [aggregate](<https://devfeed.tech/tags/aggregate.md>), [articles](<https://devfeed.tech/tags/articles.md>), [count](<https://devfeed.tech/tags/count.md>), [django](<https://devfeed.tech/tags/django.md>), [filter](<https://devfeed.tech/tags/filter.md>), [orm](<https://devfeed.tech/tags/orm.md>), [sort](<https://devfeed.tech/tags/sort.md>), [sql](<https://devfeed.tech/tags/sql.md>), [tutorial](<https://devfeed.tech/tags/tutorial.md>)

### AI overview

A tutorial explains Django ORM aggregation by comparing QuerySets with equivalent SQL GROUP BY queries. It covers counting rows, handling NULL values, grouping by fields, filtering, sorting, and multiple aggregations.

### Source excerpt

Understand GROUP BY in Django ORM by comparing QuerySets and SQL side by side. If SQL is where you are most comfortable, this is the Django GROUP BY tutorial for you.

## Optimizing the Django Admin Paginator

DevFeed: [Optimizing the Django Admin Paginator](<https://devfeed.tech/articles/optimizing-the-django-admin-paginator-33919.md>)

Original publisher: [Read original article](<https://hakibenita.com/optimizing-the-django-admin-paginator>)

Author: Haki Benita

Published: 2018-11-05T22:00:00Z

Content type: tutorial

Language: en

Sources: [Haki Benita](<https://devfeed.tech/sources/haki-benita.md>)

Topics: [Django](<https://devfeed.tech/topics/django.md>), [Scalability](<https://devfeed.tech/topics/scalability.md>), [optimize](<https://devfeed.tech/topics/optimize.md>)

Tags: [articles](<https://devfeed.tech/tags/articles.md>), [count](<https://devfeed.tech/tags/count.md>), [django](<https://devfeed.tech/tags/django.md>), [django-admin](<https://devfeed.tech/tags/django-admin.md>), [optimizing](<https://devfeed.tech/tags/optimizing.md>), [override](<https://devfeed.tech/tags/override.md>), [pages](<https://devfeed.tech/tags/pages.md>), [performance](<https://devfeed.tech/tags/performance.md>), [query](<https://devfeed.tech/tags/query.md>), [scalability](<https://devfeed.tech/tags/scalability.md>), [table](<https://devfeed.tech/tags/table.md>)

### AI overview

This article examines the Django admin paginator's performance on large tables. It explains that counting all rows can dominate page-load time and discusses optimizing Django admin for consistent performance as datasets grow.

### Source excerpt

I often talk about making Django scale but what does it actually mean? It means getting consistent performance regardless of the amount of data. In this article we tackle The last nail in Django admin's scalability coffin - the paginator.

## Postgres 9.5 - The feature rundown

DevFeed: [Postgres 9.5 - The feature rundown](<https://devfeed.tech/articles/postgres-9-5-the-feature-rundown-41184.md>)

Original publisher: [Read original article](<https://www.craigkerstiens.com/2015/12/27/Postgres-9.5-The-feature-rundown/>)

Author: Map

Published: 2015-12-27T20:55:56Z

Content type: article

Language: en

Sources: [Craig Kerstiens](<https://devfeed.tech/sources/craig-kerstiens.md>)

Topics: [Database](<https://devfeed.tech/topics/database.md>), [Replication](<https://devfeed.tech/topics/replication.md>), [import](<https://devfeed.tech/topics/import.md>), [etl](<https://devfeed.tech/topics/etl.md>)

Tags: [count](<https://devfeed.tech/tags/count.md>), [cube](<https://devfeed.tech/tags/cube.md>), [databases](<https://devfeed.tech/tags/databases.md>), [etl](<https://devfeed.tech/tags/etl.md>), [examples](<https://devfeed.tech/tags/examples.md>), [feature](<https://devfeed.tech/tags/feature.md>), [import](<https://devfeed.tech/tags/import.md>), [postgres](<https://devfeed.tech/tags/postgres.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [replication](<https://devfeed.tech/tags/replication.md>), [schema](<https://devfeed.tech/tags/schema.md>)

### AI overview

This article reviews notable features planned for Postgres 9.5, including upsert behavior, grouping sets, cube and rollup, importing foreign schemas, and pg_rewind for PostgreSQL replication management.

### Source excerpt

The headline of Postgres 9.5 is undoubtedly: Insert... on conflict do nothing/update or more commonly known as Upsert or Merge. This removes one of the last remaining features which other databases had over Postgres. Sure we'll take a look at it, but first let's browse through some of the other features you can look forward to when Postgres 9.5 lands: Grouping sets, cube, rollup Pivoting in Postgres has sort of been possible as has rolling up data, but it required you to know what those values and what you were projecting to, to be known. With the new functionality to allow you to group various sets together rollups as you'd normally expect to do in something like Excel become trivial. So now instead you simply add the grouping type just as you would on a normal group by: SELECT department, role, gender, count(*) FROM employees GROUP BY your_grouping_type_here; By simply selecting the type of rollup you want to do Postgres will do the hard work for you. Let's take a look at the given example of department, role, gender: grouping sets will project out the count for each specific key. As a result you'd get each department key, with other keys as null, and the count for each that met that department. cube will give you the same values as above, but also the rollups of every individual combination. So in addition to the total for each department, you'd get breakups by the department and gender, and department and role, and department and role and gender. rollup will give you a slightly similar version to cube but only give you the detailed groupings in the order they're presented. So if you specified roll (department, role, gender) you'd have no rollup for department and gender alone. Check the what's new wiki for a bit more clarity on examples and output Import foreign schemas I only use foreign tables about once a month, but when I do use them they've inevitably saved many hours of creating a one off ETL process. Even still the effort to setup new foreign tables has sho

## Abbreviated keys for numeric to accelerate numeric sorts

DevFeed: [Abbreviated keys for numeric to accelerate numeric sorts](<https://devfeed.tech/articles/abbreviated-keys-for-numeric-to-accelerate-numeric-sorts-33651.md>)

Original publisher: [Read original article](<https://pgeoghegan.blogspot.com/2015/04/abbreviated-keys-for-numeric-to.html>)

Author: Peter Geoghegan (noreply@blogger.com)

Published: 2015-04-04T16:19:00Z

Content type: article

Language: en

Sources: [Peter Geoghegan's blog](<https://devfeed.tech/sources/peter-geoghegan-s-blog.md>)

Topics: [PostgreSQL](<https://devfeed.tech/topics/postgresql.md>), [Sorting](<https://devfeed.tech/topics/sorting.md>), [Development](<https://devfeed.tech/topics/development.md>)

Tags: [abbreviation](<https://devfeed.tech/tags/abbreviation.md>), [benchmarks](<https://devfeed.tech/tags/benchmarks.md>), [c](<https://devfeed.tech/tags/c.md>), [cardinality](<https://devfeed.tech/tags/cardinality.md>), [commit](<https://devfeed.tech/tags/commit.md>), [count](<https://devfeed.tech/tags/count.md>), [fast](<https://devfeed.tech/tags/fast.md>), [improvements](<https://devfeed.tech/tags/improvements.md>), [indexes](<https://devfeed.tech/tags/indexes.md>), [internals](<https://devfeed.tech/tags/internals.md>), [maintenance](<https://devfeed.tech/tags/maintenance.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [sorting](<https://devfeed.tech/tags/sorting.md>), [table](<https://devfeed.tech/tags/table.md>)

### AI overview

The article discusses PostgreSQL numeric abbreviated keys, a committed patch intended to accelerate numeric sorting. It reports 6x-7x improvements for representative in-memory queries and a 12x improvement in a PostgreSQL 9.5 text-column CREATE INDEX benchmark compared with PostgreSQL 9.4.

### Source excerpt

Andrew Gierth's numeric abbreviated keys patch was committed recently. This commit added abbreviation/sortsupport for the numeric type (the PostgreSQL type which allows practically arbitrary precision, typically recommended for representing monetary values). The encoding scheme that Andrew came up with is rather clever - it has an excellent tendency to concentrate entropy from the original values into the generated abbreviated keys in real world cases. As far as accelerating sorts goes, numeric abbreviation is at least as effective as the original text abbreviation scheme. I easily saw improvements of 6x-7x with representative queries that did not spill to disk (i.e. that used quicksort). In essence, the patch makes sorting numeric values almost as cheap as sorting simple integers, since that is often all that is actually required during sorting proper (the abbreviated keys compare as integers, except that the comparison is inverted to comport with how abbreviation builds abbreviated values from numerics as tuples are copied into local memory ahead of sorting - see the patch for exact details). Separately, over lunch at pgConf.US in New York, Corey Huinker complained about a slow, routine data warehousing CREATE INDEX operation that took far too long. The indexes in question were built on a single text column. I suggested that Corey check out how PostgreSQL 9.5 performs, where this operation is accelerated by text abbreviation, often very effectively. Corey chose an organic set of data that could be taken as a reasonable proxy for how PostgreSQL behaves when he performs these routine index builds. In all cases maintenance_work_mem was set to 64MB, meaning that an external tapesort is always required - those details were consistent. This was a table with 18 million rows. Apparently, on PostgreSQL 9.4, without abbreviation, the CREATE INDEX took 10 minutes and 19 seconds in total. On PostgreSQL 9.5, with identical settings, it took only 51.3 seconds - a 12x improvemen

## PostgreSQL, Aggregates and Histograms

DevFeed: [PostgreSQL, Aggregates and Histograms](<https://devfeed.tech/articles/postgresql-aggregates-and-histograms-34535.md>)

Original publisher: [Read original article](<https://tapoueh.org/blog/2014/02/postgresql-aggregates-and-histograms/>)

Author: Dimitri Fontaine PostgreSQL Major Contributor; Author

Published: 2014-02-21T12:25:00Z

Content type: tutorial

Language: en

Sources: [Dimitri Fontaine](<https://devfeed.tech/sources/dimitri-fontaine.md>)

Topics: [PostgreSQL](<https://devfeed.tech/topics/postgresql.md>), [SQL](<https://devfeed.tech/topics/sql.md>), [MongoDB](<https://devfeed.tech/topics/mongodb.md>), [Mathematics](<https://devfeed.tech/topics/mathematics.md>), [dataset](<https://devfeed.tech/topics/dataset.md>)

Tags: [aggregation](<https://devfeed.tech/tags/aggregation.md>), [article](<https://devfeed.tech/tags/article.md>), [console](<https://devfeed.tech/tags/console.md>), [count](<https://devfeed.tech/tags/count.md>), [dataset](<https://devfeed.tech/tags/dataset.md>), [documentation](<https://devfeed.tech/tags/documentation.md>), [function](<https://devfeed.tech/tags/function.md>), [mongodb](<https://devfeed.tech/tags/mongodb.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [query](<https://devfeed.tech/tags/query.md>), [reporting](<https://devfeed.tech/tags/reporting.md>), [sql](<https://devfeed.tech/tags/sql.md>), [statistics](<https://devfeed.tech/tags/statistics.md>), [table](<https://devfeed.tech/tags/table.md>)

### AI overview

A tutorial on using PostgreSQL SQL aggregates and the width_bucket function to build equidepth histograms from NBA game rebound data. It explains how to compute bucket ranges and frequencies, then render a compact histogram in the SQL console.

### Source excerpt

In our previous article Aggregating NBA data, PostgreSQL vs MongoDB we spent time comparing the pretty new MongoDB Aggregation Framework with the decades old SQL aggregates. Today, let's showcase more of those SQL aggregates, producing a nice histogram right from our SQL console.

## Postgres Indexes - Expression/Functional Indexing

DevFeed: [Postgres Indexes - Expression/Functional Indexing](<https://devfeed.tech/articles/postgres-indexes-expression-functional-indexing-41140.md>)

Original publisher: [Read original article](<https://www.craigkerstiens.com/2013/05/29/Postgres-Indexes-Expression/Functional-Indexing/>)

Author: Map

Published: 2013-05-29T20:55:56Z

Content type: tutorial

Language: en

Sources: [Craig Kerstiens](<https://devfeed.tech/sources/craig-kerstiens.md>)

Topics: [PostgreSQL](<https://devfeed.tech/topics/postgresql.md>), [Query (disambiguation)](<https://devfeed.tech/topics/query.md>), [Code](<https://devfeed.tech/topics/code.md>), [data](<https://devfeed.tech/topics/data.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [count](<https://devfeed.tech/tags/count.md>), [function](<https://devfeed.tech/tags/function.md>), [functions](<https://devfeed.tech/tags/functions.md>), [indexes](<https://devfeed.tech/tags/indexes.md>), [indexing](<https://devfeed.tech/tags/indexing.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [json](<https://devfeed.tech/tags/json.md>), [postgres](<https://devfeed.tech/tags/postgres.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [reporting](<https://devfeed.tech/tags/reporting.md>), [sql](<https://devfeed.tech/tags/sql.md>), [table](<https://devfeed.tech/tags/table.md>)

### AI overview

A tutorial on PostgreSQL expression and functional indexes. It demonstrates indexing date expressions for reporting, using custom PLV8 functions to index values in JSON fields, and combining expressions with built-in functions for case-insensitive lookups.

### Source excerpt

Postgres is rich with options for indexing. First you've got a variety of types, and beyond that you can do a variety of things with each of these such as create unique indexes, use conditions to index only a portion of your data, or create indexes based on complex expressions or functions. In cases where you commonly use various PostgreSQL functions in your application or reporting you can get some great gains from this. Let's take a look at a really simple case. Given a basic user table: # \dt users Table "public.users" Column | Type | Modifiers ------------+-----------------------------+----------- id | integer | not null email | character varying(255) | created_at | timestamp without time zone | You may commonly want to run a report against it showing your signups by date. Let's say you do this by running the query: SELECT count(*), date_trunc('day', created_at) FROM users GROUP BY 2; If you're commonly using date_trunc('day', created_at) for grouping, filtering, or projecting it out you can get some great gains by creating an index on this: # CREATE INDEX idx_user_created ON users(date_trunc('day', created_at)); Of course you can go beyond the built in functions of Postgres and use more complicated functions you create yourself. For example if you have JSON stored within PostgreSQL, have PLV8 enabled, and want to create a Javascript function to parse and return the text for a given key: # CREATE OR REPLACE FUNCTION get_text(key text, data json) RETURNS text $$ return data[key]; $$ LANGUAGE plv8 IMMUTABLE STRICT; Of note in the above function is IMMUTABLE and STRICT. Immutable specifies that the function given the same inputs will return the same result. Strict means that if you send in NULL values you'll get a null result. Given some example data inside your JSON field: { "name": "Craig Kerstiens", "location": "San Francisco", "numbers": [ { "type": "work", "number": "123.456.7890" }, { "type": "home", "number": "987.654.3210" } ] } If you wanted to return just

## Rapid API Prototyping with Heroku Postgres Dataclips

DevFeed: [Rapid API Prototyping with Heroku Postgres Dataclips](<https://devfeed.tech/articles/rapid-api-prototyping-with-heroku-postgres-dataclips-41116.md>)

Original publisher: [Read original article](<https://www.craigkerstiens.com/2012/07/19/Rapid-API-Prototyping-with-Heroku-Postgres-Dataclips/>)

Author: Map

Published: 2012-07-19T20:55:56Z

Content type: tutorial

Language: en

Sources: [Craig Kerstiens](<https://devfeed.tech/sources/craig-kerstiens.md>)

Topics: [Heroku](<https://devfeed.tech/topics/heroku.md>), [Heroku Postgres](<https://devfeed.tech/topics/heroku-postgres.md>), [API](<https://devfeed.tech/topics/api.md>), [Database](<https://devfeed.tech/topics/database.md>), [JSON](<https://devfeed.tech/topics/json.md>), [CSV](<https://devfeed.tech/topics/csv.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [apis](<https://devfeed.tech/tags/apis.md>), [count](<https://devfeed.tech/tags/count.md>), [csv](<https://devfeed.tech/tags/csv.md>), [heroku](<https://devfeed.tech/tags/heroku.md>), [heroku-postgres](<https://devfeed.tech/tags/heroku-postgres.md>), [json](<https://devfeed.tech/tags/json.md>), [real-time](<https://devfeed.tech/tags/real-time.md>)

### AI overview

This tutorial explains how to use Heroku Postgres Dataclips to prototype APIs. It demonstrates creating SQL queries, exposing their results through a unique URL, optionally rerunning them as a real-time API, and requesting formats such as JSON, CSV, and XLS.

### Source excerpt

For small and large applications there often comes a time where you're busy creating an API. The API creation process usually takes the form of something like: Design your API, Implement your API, Test and Evaluate, Rinse and Repeat. Historically with implementing the API fully you can't see how you truly feel about the result, causing this cycle to take longer than it should. Heroku Postgres has Dataclips, which (among other things) can be used for quickly prototyping APIs. Dataclips allows you to easily share data, but more importantly consume it in a form much like you would a restful API. Lets take a look at how this would work: Given a schema We can see from the screen shot of the schema above we can see we have a few tables. These tables are the complete works of Shakespeare thanks to opensourceshakespeare. Lets take a couple of hypothetical endpoints we've decided on that we'd like to expose for users and test as an API. The number of works per year Drone factory (this is a fun one courtesy of Richard Morrison - @mozz100 essentially who has the longest paragraphs on average in his works. Create a dataclip Now we open up our database on Heroku Postgres and go down near the bottom to the dataclips section. Click the plus to create a new dataclip and we can enter our queries. SELECT year, count(*) FROM works GROUP BY year ORDER BY year ASC Click Create Clip and you'll be redirected to your new dataclip. This unique URL will always return the results of that query and if you want to shift it to a real time API that re-runs the query you can flip the now switch. For my simple example above my url for this dataclip is now https://dataclips.heroku.com/fcroecrluhwltbjinstfqmwyneex. Using the dataclip as a prototype API There are many different use cases for dataclips, but of course for our sake we care about prototyping an API instead of sharing the data. To do this you can simply append the format you want to the url above and test as if it were an API: JSON - https