I have a scheduled query in Redshift that simply will not run. It works when I execute the query manually in the query editor, just not when scheduled. I can't seem to find any feedback about why it's failing, though. I can see the schedule history, a unique Id, and the status of "Failed", but no more info.
Is there a system table/view that I can dig into and find out what's going on with my query? The SQL consists of basic select, update, insert style code - nothing fancy, just long.
You can look for any errors using:
select
process,
errcode,
linenum as line,
trim(error) as err
from
stl_error;
Also: Retrieve Redshift error messages
Ref.: STL_ERROR
It says in the description that it doesn't record SQL errors which would likely be the problem of the failed query.
I'm trying to sort this one as well and it seems it's limited as I only see the
Any idea how to get the associated query ID, PID, or EID so I can check maybe against the query history?
Related
Using postgresql-14 with pgadmin4
The task is vague but requests that I insert the data into a new table and then verify the data. I want to believe there is some "standard" or process to verify that the data was moved correctly and is intact, is there such a thing? I'm not sure how to "show" that the data is verified as correct in the new table.
For this insert:
INSERT INTO car_detail(id, make, model, price, year)
SELECT dealership_stock.id AS id,
manufacturers.make AS make,
models.model_name AS model,
price_sheet.price AS price,
model_years.year AS year,
FROM dealership_stock
INNER JOIN.... etc.
TIA - it seems like a simple and logical task, but I am baffled on how to execute and prove it.
Dai and Bjarni were correct - verification isn't required in the code. The requirement was implying that the dataset would be viewed and confirmed that the data was present in the new table. And here I had hoped to learn of some fancy new command to verify data and instead am taking Belayer's comment to heart that I need to keep asking questions until I understand the requirements! Thanks everyone!
Good day,
I run many databases under interbase XE7 and 2017 now.
Lately, I got a strange behavior on one of the db:
A table with a primary key was found hosting many rows with similar values, like image below.
We can see that SCRIPTTYPE is a primary key column and it contains many times MATRIX, no space or strange characters ( I checked).
I was able to backup / restore without issues.
I am puzzled by this and I am wondering if anybody did encountered something similar?
And how it was done?
Thanks.
enter image description here
Run this query to be sure:
select SCRIPTTYPE, count(*)
from yourtable
group by SCRIPTTYPE
order by 2 desc
If you get a count>1, then I'd argue it's simple a bug and you should contact support. For them to assist you they'll almost certainly need your database, so you should be prepared to provide that. Based on your description, you should be able to drop all tables except the one, and drop all fields except your key, then backup and restore to get the simplest test case.
For one customer site, the following query:
select /*+ ods(false) */ *
from Werkgevers#loket wgr
join PersonenPerWerkgever(wgr.entryid)#loket psn
join WerknemerVerloningsrunsPerPersoon(wgr.entryid)#loket wvn
returns an error with message code "s:Client" and text "Not Allowed List".
I seem unable to find any documentation on this loket.nl error with Invantive SQL. How can I fix it?
This error is typically caused by missing privileges. The text is not very well formulated, but you will have to live with it since Loket is focusing on adding a new REST-based API platform.
Make sure your user has sufficient privileges.
I want to set log_statement for only select statements if possible, otherwise i will use all statement.
After that i want to list queries to get information about whether a particular query hasnt used a particular index. Because when i drop and recreate that particular index, i want to check later if a query hasnt got benefit from this particular index.
I guess SELECT * FROM pg_stat_activity wouldnt help.
Is it possible to list queries to get this information?
You can use auto-explain to save execution plan to logs.
Also take a look at pg_stat_statements to select (rank) slow statements right in db catalog...
I have a (very simple and standard) UPDATE statement which works fine either directly in Query Analyser, or executed as a stored procedure in Query Analyser.
UPDATE A
SET
A.field1 = B.col1
, A.field2 = B.col2
FROM
tblA AS A INNER JOIN tblB AS B
ON A.pk1 = B.pk1 AND A.pk2 = B.pk2
Problem is when i execute the same stored proc via microsoft ADP (by double-clicking on the sproc name or using the Run option), it says "query ran successfully but did not return records" AND does NOT update the records when i inspect the tables directly.
Before anyone even says "syntax of MS-Access is different than SQLServer T-SQL", remember that with ADP everything happens on the server and one is actually passing thru to T-SQL.
Any bright ideas from any ADP gurus out there?
Gotcha. Responding to my own question for the benefit of anyone else.
Tools / Options / Advanced / Client-Server Settings / Default max records is set at 10,000 (presumably this is the default). Change this to 0 for unlimited.
My table had 100,000+ rows and whatever set of 10,000 it was updating was difficult to find ( among a sea of 90,000+ un-updated rows ). Hence the update did not work fully as expected.
Try and see whether the query gets executed on the SQL Server using SQL profiler.
Also, I think you might need to close the linked table & re-open it to see the updated records.
Does that work?
Run the query with SQL PRofiler running. Before you start the trace add in all the error events. This will give you any errors that the SQL Server is generating that the Access ADP might not be showing correctly (or at all).
Feel free to post them here.
Just as a reference, here's a paper I wrote on Update Queries that discusses some of the issues associated with when the fail.
http://www.fmsinc.com/microsoftaccess/query/snytax/update-query.html
I seem to remember that I always got the "didn't return any rows" message and had to simply turn off the messaging. It's because it isn't returning any rows!
as for the other - sometimes there's a primary key issue. Does the table being updated have a primary key in SQLServer? If so, check the view of the table in Access - sometimes that link doesn't come through. It's been a while, so I could be wrong, but I think you may need to look at the design view of the table while in access and add the primary key there.
EDIT: Additional thought:
in your debugging, try throwing in print statements to see what the values of your inputs are. Is it actually picking up the data from the table as you expect when you execute from access?