diff --git a/content/700-optimize/300-recordings.mdx b/content/700-optimize/300-recordings.mdx index 64cd4f7204..0216f08370 100644 --- a/content/700-optimize/300-recordings.mdx +++ b/content/700-optimize/300-recordings.mdx @@ -45,6 +45,7 @@ When a recording session ends, Optimize generates recommendations such as: - [Using `@db.Char(n)`](/optimize/recommendations/avoid-char) - [Using `@db.VarChar(n)`](/optimize/recommendations/avoid-varchar) - [Using `timestamp(0)` or `timestamptz(0)`](/optimize/recommendations/avoid-timestamp-timestampz-0) +- [Using `CURRENT_TIME`](/optimize/recommendations/current-time) - [Storing large objects or BLOBs in the database](/optimize/recommendations/storing-blob-in-database) - [Indexing on unique columns](/optimize/recommendations/indexing-on-unique-columns) - [Long-running transactions](/optimize/recommendations/long-running-transactions) diff --git a/content/700-optimize/400-recommendations/1000-current-time.mdx b/content/700-optimize/400-recommendations/1000-current-time.mdx new file mode 100644 index 0000000000..493f009066 --- /dev/null +++ b/content/700-optimize/400-recommendations/1000-current-time.mdx @@ -0,0 +1,17 @@ +--- +title: 'Using CURRENT_TIME' +metaTitle: 'Optimize Recommendations: Avoid usage of `CURRENT_TIME`' +metaDescription: 'Learn about the recommendation provided by Optimize for using the `CURRENT_TIME` function' +tocDepth: 2 +toc: true +--- + +The following raw SQL query uses the `CURRENT_TIME` function: + +```ts +prisma.$queryRaw`SELECT CURRENT_TIME;` +``` + +### Why this is a problem + +The `CURRENT_TIME` keyword returns only the time (e.g., 14:30:00) without a date, making it unsuitable for tasks like logging or generating timestamps that require precise event tracking. It returns a value of type `timetz`, which was added for SQL standard compatibility but is generally discouraged.