Preamble
PostgreSQL length function returns the length of the specified string, expressed in the number of characters.
Syntax of the length function in PostgreSQL
length( string )
Parameters and function arguments
- string – The string for which the length is returned.
The length function can be used in the following PostgreSQL versions
PostgreSQL 11, PostgreSQL 10, PostgreSQL 9.6, PostgreSQL 9.5, PostgreSQL 9.4, PostgreSQL 9.3, PostgreSQL 9.2, PostgreSQL 9.1, PostgreSQL 9.0, PostgreSQL 8.4.
Let’s look at some examples of length functions to see how to use the length function in PostgreSQL.
For example:
SELECT length('Google Yandex Bing');
--Result: 18
SELECT length('Google.com');
--Result: 10
SELECT length(' Yandex.com');
--Result: 11
SELECT length('');
--Result: 0
SELECT length(' ');
--Result: 1
SELECT length(NULL);
--Result: [null];
Use PostgreSQL Constraints, Functions and Triggers for Data Validations
About Enteros
Enteros offers a patented database performance management SaaS platform. It proactively identifies root causes of complex business-impacting database scalability and performance issues across a growing number of clouds, RDBMS, NoSQL, and machine learning database platforms.
The views expressed on this blog are those of the author and do not necessarily reflect the opinions of Enteros Inc. This blog may contain links to the content of third-party sites. By providing such links, Enteros Inc. does not adopt, guarantee, approve, or endorse the information, views, or products available on such sites.
Are you interested in writing for Enteros’ Blog? Please send us a pitch!
RELATED POSTS
Revolutionizing the BFSI Sector: How Enteros Harnesses Generative AI and AIOps for Next-Generation Performance Management
- 9 November 2025
- Database Performance Management
Introduction In the fast-evolving Banking, Financial Services, and Insurance (BFSI) sector, digital transformation is not just a competitive advantage—it’s an operational necessity. Every second of downtime, lagging transaction, or database bottleneck can translate into millions in lost revenue, compliance risks, and diminished customer trust. The BFSI industry depends on robust, scalable, and intelligent systems that … Continue reading “Revolutionizing the BFSI Sector: How Enteros Harnesses Generative AI and AIOps for Next-Generation Performance Management”
Transforming the Education Sector: How Enteros Enhances Database Performance Optimization and Unites Cloud FinOps with RevOps Efficiency
Introduction The education sector is undergoing a massive digital transformation. From online learning platforms and student information systems to AI-driven analytics and cloud-hosted research databases, educational institutions rely on complex, data-rich ecosystems to deliver high-quality experiences to students, educators, and administrators. However, as data volumes surge and cloud adoption accelerates, institutions face growing challenges — … Continue reading “Transforming the Education Sector: How Enteros Enhances Database Performance Optimization and Unites Cloud FinOps with RevOps Efficiency”
$11B at Stake — How Supply-Chain Delays Are Forcing Airlines to Fly Older Planes
- 7 November 2025
- Software Engineering
Introduction The aviation industry is entering 2025 at a critical inflection point. According to a joint report by the International Air Transport Association (IATA) and Oliver Wyman, global airlines could face over $11 billion in additional costs this year due to persistent supply-chain disruptions. The most visible consequence is the forced reliance on older, less … Continue reading “$11B at Stake — How Supply-Chain Delays Are Forcing Airlines to Fly Older Planes”
Enhancing Cost Estimation and Attribution in the Technology Sector: How Enteros Uses AI Performance Management to Drive Financial and Operational Efficiency
- 6 November 2025
- Database Performance Management
Introduction In the dynamic world of the technology sector, cost estimation and attribution have become as critical as innovation itself. As companies expand their cloud infrastructures, deploy AI-driven workloads, and manage vast databases across multi-cloud ecosystems, the challenge lies in maintaining both financial precision and performance optimization. Technology enterprises need a clear understanding of where … Continue reading “Enhancing Cost Estimation and Attribution in the Technology Sector: How Enteros Uses AI Performance Management to Drive Financial and Operational Efficiency”