I need to count the number of users in every month. I have written query.
SELECT COUNT(distinct user_id)
from (
select TO_CHAR((current_date - interval '1 month' * a),'YYYY-MM') as MyMonth
from generate_series(1,60,1) AS s(a)
) months
LEFT OUTER JOIN database.users
ON months.MyMonth=to_char(created_at, 'YYYY-MM')
GROUP BY months.MyMonth
But when I try to execute it, the mistake appears: "Specified types or functions (one per INFO message) not supported on Redshift tables." Whether it is possible to rewrite somehow this query or specify please where a mistake?
A query can abort in Amazon Redshift for the following reasons: Setup of Amazon Redshift workload management (WLM) query monitoring rules. Statement timeout value. ABORT, CANCEL, or TERMINATE requests.
Amazon Redshift supports SQL client tools connecting through Java Database Connectivity (JDBC) and Open Database Connectivity (ODBC). Amazon Redshift doesn't provide or install any SQL client tools or libraries, so you must install them on your client computer or Amazon EC2 instance to use them.
Load takes too long Your load operation can take too long for the following reasons; we suggest the following troubleshooting approaches. Split your load data into multiple files. When you load all the data from a single large file, Amazon Redshift is forced to perform a serialized load, which is much slower.
This error usually indicates some problem with compatibility of data in your file and redshift tables. you can get more insights about error in table 'SVL_S3LOG'. In my case it was because file had some invalid utf8 characters.
The generate_series()
command is not fully supported on Amazon Redshift.
It can be used for queries that run solely on the Leader node, but cannot be used in queries that involve tables because they involve cluster nodes. The only workaround is to create a large table with lots of values and join to it to get a range of numbers. (A bit of work up front, but then it works fine.)
You'll find many similar Questions on StackOverflow related to generate_series()
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With