Search
 
SCRIPT & CODE EXAMPLE
 

SQL

postgresql datetrunc too slow

CREATE INDEX ON test (date_trunc('day', updated_at));

/*If updated_at is a timestamp without time zone, that will work fine. 
For a timestamp with time zone, you'll have to specify a time zone, 
because otherwise the result will depend on the session time zone, 
which makes it unusable for an index:*/

CREATE INDEX ON test (date_trunc('day', updated_at AT TIME ZONE 'UTC'));
Comment

PREVIOUS NEXT
Code Example
Sql :: postgres select from last 3 months 
Sql :: how to copy a table from one database to another in mysql 
Sql :: psql view enum values 
Sql :: mysql take number in string 
Sql :: mysql increment value by 1 in update 
Sql :: oracle create schema 
Sql :: sql drop primary key 
Sql :: group_concat limit mysql 
Sql :: grant permission in postgres 
Sql :: how to check data type in sql server 
Sql :: mysql select table names 
Sql :: drop column if exists sql server 
Sql :: mysql left join exists 
Sql :: mssql reset auto increment 
Sql :: mysql set root password 
Sql :: jooq convert using gbk 
Sql :: sqlite foreign key 
Sql :: snowflake alter column data type 
Sql :: sometimes i cant edit sql developer 
Sql :: cursor in sql server 
Sql :: hibernate with springboot mysql 
Sql :: convert int to varchar sql 
Sql :: import sql file in mysql 
Sql :: operadores en postgresql 
Sql :: truncate left characters mysql 
Sql :: truncate table 
Sql :: oracle cannot access v$session 
Sql :: clear screen command in psql 
Sql :: get first 3 letters in sql 
Sql :: strict in postgres SQL 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =