I try to write a query to delete some rows in treasure-data but the server ignored it. I'm missing documentation to resolve this issue.
Here is the logs:
Use 'td job:show 2485728' to show the status.
queued...
started at 2013-04-18T10:22:32Z
Hive history file=/mnt/hive/tmp/2073/hive_job_log__336863980.txt
finished at 2013-04-18T10:22:39Z
Ignored "delete from mytable where time < unix_timestamp() - 30*60*60*24"
Sorry, but there is no delete statement in HIVE. One possible trick could be rewriting the table:
INSERT OVERWRITE TABLE mytable
SELECT * FROM mytable
WHERE time >= unix_timestamp() - 30*60*60*24
Related
my query just runs and doesnt execute, what is wrong. work on oracle sql developer, company server
CREATE TABLE voice2020 AS
SELECT
to_char(SDATE , 'YYYYMM') as month,
MSISDN,
SUM(CH_MONEY_SUBS_DED)/100 AS AIRTIME_VOICE,
SUM(CALLDURATION/60) AS MIN_USAGE,
sum(DUR_ONNET_OOB/60) as DUR_ONNET_OOB,
sum(DUR_ONNET_IB/60) as DUR_ONNET_IB,
sum(DUR_ONNET_FREE/60) as DUR_ONNET_FREE,
sum(DUR_OFFNET_OOB/60) as DUR_OFFNET_OOB,
sum(DUR_OFFNET_IB/60) as DUR_OFFNET_IB,
sum(DUR_OFFNET_FREE/60) as DUR_OFFNET_FREE,
SUM(case when sdate < to_date('20190301','YYYYMMDD')
then CH_MONEY_PAID_DED-nvl(CH_MONEY_SUBS_DED,0)-REV_VOICE_INT-REV_VOICE_ROAM_OUTGOING-REV_VOICE_ROAM_Incoming
else (CH_MONEY_OOB-REV_VOICE_INT-REV_VOICE_ROAM_OUTGOING-REV_VOICE_ROAM_Incoming) end)/100 AS VOICE_OOB_SPEND
FROM CCN.CCN_VOICE_MSISDN_MM#xdr1
where MSISDN IN ( SELECT MSISDN FROM saayma_a.BASE30112020) --change date
GROUP BY
MSISDN,
to_char(SDATE , 'YYYYMM')
;
This is a performance issue. Clearly the query driving your CREATE TABLE statement is taking too long to return a result set.
You are querying from a table in a remote database (CCN.CCN_VOICE_MSISDN_MM#xdr1) and then filtering against a local table (saayma_a.BASE30112020) . This means you are going to copy all of that remote table across the network, then discard the records which don't match the WHERE clause.
You know your data (or at least you should know it): does that sound efficient? If you're actually discarding most of the records you should try to filter CCN_VOICE_MSIDN_MM in the remote database.
If you need more advice you need to provide more information. Please read this post about asking Oracle tuning questions on this site, then edit your question to include some details.
You are executing CTAS (CREATE TABLE AS SELECT) and the purpose of this query is to create the table with data which is generated via this query.
If you want to just execute the query and see the data then remove first line of your query.
-- CREATE TABLE voice2020 AS
SELECT
.....
Also, the data of your actual query must be present in the voice2020 table if you have already executed it once.
Select * from voice2020;
Looks like you are trying to copying the data from one table to another table, Can you once create the table if it's not created and then try this statement.
insert into target_table select * from source_table;
I'm trying to delete some information from a table that has a date < 16/16/2019 in C#. The query gave me an exception so I'm trying to do it directly in MS Access and even here it gave me error.
SELECT *
FROM TableName
WHERE (((TableName.Date)<= #16/06/2019#));
If I use the above, the query gives me the result that I expect which is all information which is stored before a specific date.
But if I use the DELETE statement:
DELETE
FROM TableName
WHERE (((TableName.Date)<= #16/06/2019#));
It gives me the error:
The search key was not found in any record
Why?
Given the information in the comments, I would suggest the following:
delete from TableName t where t.data <= #2019-06-16#
my hive sql query runs perfect in putty and also in hue editor. But when I try to create a workflow in Oozie, it fails with the following error -
Launcher ERROR, reason: Main class [org.apache.oozie.action.hadoop.Hive2Main], exit code [2]
can you help me on this!
Hard to say without knowing how your query looks like but it might worth to double check comments in your hql file if you have any.
For instance, this query
SELECT * FROM (
SELECT 1,2
) tbl
WHERE
1 = 1; -- some description goes here
ALTER TABLE my_table RENAME TO your_table;
will be executed via HUE as 2 different ones, but once it runs via Oozie's Hive2 action you will see that "ALTER TABLE ..." becomes a part of comment of your "SELECT ...".
So potential solution might look like
SELECT * FROM (
SELECT 1,2
) tbl
WHERE
1 = 1; -- some description goes here;
ALTER TABLE my_table RENAME TO your_table;
or just drop the comment altogether
I have a remote mainframe db2 database for which I have created nicknames in my db2 server .
Problem is as below -
When I run query
SELECT * FROM LNICKNAME.TABLE - It runs and I can get all columns.
but if I run below query it never gives me any output and keeps running .
SELECT * FROM LNICKNAME.TABLE a where a.columnB = 'ADH00040';
So technically it does not work if I add any where condition .
It doesn't seem like there is an error with your SELECT statement. So I am assuming that one of two things are happening:
Senario 1:
The file is really big and there isn't an index on columnB. If this is the case it would take long as the DB would have to read through each record and check if columnB = 'ADH00040'. To see how many records are in the table just run a count on the table
SELECT COUNT(*) FROM LNICKNAME.BMS_TABLE
Senario 2:
Something or someone is disconnecting your connection before your query is complete. I know you can limit the amount of CPU time a iSeries job is allowed before it gets ended forceably (CHGJOB CPUTIME(60000)). Is there no form of a job log that you could share with us?
Are you sure your value is into your table?
try a like :
SELECT * FROM LNICKNAME.TABLE a where a.columnB like '%ADH00040%';
This is regarding Oracle SQLPLUS query language.
SELECT * FROM mytable WHERE record_date > time_4_hours_ago;
I have tried several methods, described on net and all of them did not work for me.
Tied UNIX_SYSTEM_TIME as well.
Problem seems a pretty common one, but I am struggling to get a solution that works with "Oracle" SQLPLUS.
Assuming record_date is a DATE field:
SELECT * FROM mytable WHERE record_date > sysdate - (4/24)
Try this:
select *
from mytable
where record_date > sysdate - interval '240' minute
To avoid invalid datetime values due to time zone differences you should override (record_date) value at the server side "using a database trigger for example" so as to insert the correct datetime value.