Products
Time series and analytics
PostgreSQL but faster. Built for lightning-fast ingest and querying of time-based and event data.
Time series and analyticsAI and Vector
PostgreSQL for AI. Seamlessly build RAG, search, and AI agents with the pgvector, pgvectorscale, and pgai extensions.
AI and VectorDeployment options & services
Support Services
Support options to adapt to your use case, infrastructure, and budget.
Open-Source Extensions and Tools
Open-source PostgreSQL extensions you can run on your own instances.
Security scanner
pgspot
We’re in your corner even during the trial phase. Contact us to discuss your use case with a Timescale technical expert.
Timescale is PostgreSQL made Powerful
Industries that rely on us
Featured articles
PostgreSQL for Industrial IoT Data
How OpenSauced Is Building a Copilot for Git History With pgvector and Timescale
AI and Vector
PostgreSQL for AI. Seamlessly build RAG, search, and AI agents with the pgvector, pgvectorscale, and pgai extensions.
pgai docspgvector docsAI and VectorLearn PostgreSQL
Timescale is PostgreSQL, but faster. Learn the PostgreSQL basics and scale your database performance to new heights
Subscribe to the Timescale Newsletter
By submitting, you acknowledge Timescale’s Privacy Policy
By submitting, you acknowledge Timescale’s Privacy Policy
$$
CREATE FUNCTION add(integer, integer) RETURNS integer
AS 'select $1 + $2;'
LANGUAGE SQL
IMMUTABLE
RETURNS NULL ON NULL INPUT;
$$
// Create a function to add 2 integers (SQL)
This function takes two integers as parameters
IMMUTABLE
means that the function cannot modify the database and always returns the same result when given the same argument values.
select add(5,9);
add
-----
14
(1 row)
// Function call (SQL)
\df
List of functions
Schema | Name | Result data type | Argument data types | Type
--------+------+------------------+---------------------+--------
public | add | integer | integer, integer | normal
(1 row)
// Display all Functions (psql)
\df+
// Display all functions and additional information, including owner, source code, and description, etc. (psql)
\ef myfunction
// Edit a function in default editor (psql)