-
Notifications
You must be signed in to change notification settings - Fork 783
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add optimize recommendation to avoid current_time (#6550)
* feat: add optimize recommendation to avoid current_time * fix: spelling mistakes --------- Co-authored-by: Jon Harrell <[email protected]>
- Loading branch information
1 parent
b01d20c
commit 504b416
Showing
2 changed files
with
18 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
content/700-optimize/400-recommendations/1000-current-time.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |