Extract Domain
This function extracts the main domain from a URL using an optimized static TLD lookup system. The extension uses Mozilla's Public Suffix List compiled into a gperf-generated perfect hash function for O(1) TLD lookups with zero collisions.
The TLD lookup is built into the extension at compile time using the latest Mozilla Public Suffix List. No runtime downloads or database operations are required.
D SELECT extract_domain('a.example.com') AS domain;
βββββββββββββββ
β domain β
β varchar β
βββββββββββββββ€
β example.com β
βββββββββββββββ
D SELECT extract_domain('https://b.a.example.com/path') AS domain;
βββββββββββββββ
β domain β
β varchar β
βββββββββββββββ€
β example.com β
βββββββββββββββLast updated
Was this helpful?