Concurrent delete queries on one table
Hi folks,
I just recently started working with SQL server. I did my research and I guess that the post http://social.msdn.microsoft.com/Forums/en-US/7fe7499e-10a5-4371-84a4-aa1df8187a04/can-i-prevent-deadlock-during-concurrent-delete?forum=transactsql hits and somehow
sovles my problem 100%.
I am glad to have my issue resolved but I am also interested in understanding what went wrong deep inside as much as learn what I might do better. My scenario:
4 processes updating disjunct entries at different intervals within the same table and issuing delete queries on that table. Sometimes (maybe once a day) that gives me a deadlock. colums: value, mainclass, subclass, timestamp with a clustered index at timestamp
(My statement is of the form "delete from table where maintype=sth and subtype=sth and timestamp=st")
I'll append a sample deadlock graph. My main questions, which I couldn't answer so far:
1. Is this expected behaviour or should SQL Server be able to handle such requests, or to put it right do I have to care for structures that avoid the above scenario, do I have to reconfigure or is there sth else to look at?
2. Is this a configuration problem?
3. I also do not understand why the report states that the processes fought for page ids when the lock escalation type was set to table.
4. As far as I got to know until now having a clustered index on the timestamp colum is likely to boost my problem rather than solving it?
I am really looking forward to any insights you can give.
Bye,
Lamu
<deadlock>
<victim-list>
<victimProcess id="process56d746188" />
</victim-list>
<process-list>
<process id="process56d746188" taskpriority="0" logused="0" waitresource="PAGE: 5:1:210559 " waittime="3120" ownerId="2642852343" transactionname="user_transaction" lasttranstarted="2014-09-05T11:16:12.683" XDES="0x5a36bd740" lockMode="U" schedulerid="4" kpid="3204" status="suspended" spid="72" sbid="1" ecid="4" priority="0" trancount="0" lastbatchstarted="2014-09-05T11:16:12.990" lastbatchcompleted="2014-09-05T11:16:12.683" lastattention="1900-01-01T00:00:00.683" clientapp="WIRELESS LOCALIZATION SYSTEM 1.15.0" hostname="S-ITCS-ORTUNG" hostpid="6504" isolationlevel="read committed (2)" xactid="2642852343" currentdb="5" lockTimeout="4294967295" clientoption1="671088672" clientoption2="128056">
<executionStack>
<frame procname="adhoc" line="1" stmtstart="94" sqlhandle="0x020000008e714d2c0ee98fc35b8a7712a719321f42c9366a0000000000000000000000000000000000000000">
DELETE [statisticlog] WHERE [statisticid]=@1 AND [storageid]=@2 AND [timest]<@3 </frame>
<frame procname="adhoc" line="1" sqlhandle="0x02000000e1914b015d3b4d5ca54af4b548f2990acfe909ec0000000000000000000000000000000000000000">
DELETE from statisticlog where ((statisticid='node.temperatur') and (storageid='17:85:00:00:1a:18.0')) AND timest < {ts '1970-01-01 01:00:00.000' } </frame>
</executionStack>
<inputbuf>
DELETE from statisticlog where ((statisticid='node.temperatur') and (storageid='17:85:00:00:1a:18.0')) AND timest < {ts '1970-01-01 01:00:00.000' } </inputbuf>
</process>
<process id="process7edeee188" taskpriority="0" logused="0" waitresource="PAGE: 5:1:196655 " waittime="3124" ownerId="2642852343" transactionname="user_transaction" lasttranstarted="2014-09-05T11:16:12.683" XDES="0x8747f1740" lockMode="U" schedulerid="2" kpid="7108" status="suspended" spid="72" sbid="1" ecid="2" priority="0" trancount="0" lastbatchstarted="2014-09-05T11:16:12.990" lastbatchcompleted="2014-09-05T11:16:12.683" lastattention="1900-01-01T00:00:00.683" clientapp="WIRELESS LOCALIZATION SYSTEM 1.15.0" hostname="S-ITCS-ORTUNG" hostpid="6504" isolationlevel="read committed (2)" xactid="2642852343" currentdb="5" lockTimeout="4294967295" clientoption1="671088672" clientoption2="128056">
<executionStack>
<frame procname="adhoc" line="1" stmtstart="94" sqlhandle="0x020000008e714d2c0ee98fc35b8a7712a719321f42c9366a0000000000000000000000000000000000000000">
DELETE [statisticlog] WHERE [statisticid]=@1 AND [storageid]=@2 AND [timest]<@3 </frame>
<frame procname="adhoc" line="1" sqlhandle="0x02000000e1914b015d3b4d5ca54af4b548f2990acfe909ec0000000000000000000000000000000000000000">
DELETE from statisticlog where ((statisticid='node.temperatur') and (storageid='17:85:00:00:1a:18.0')) AND timest < {ts '1970-01-01 01:00:00.000' } </frame>
</executionStack>
<inputbuf>
DELETE from statisticlog where ((statisticid='node.temperatur') and (storageid='17:85:00:00:1a:18.0')) AND timest < {ts '1970-01-01 01:00:00.000' } </inputbuf>
</process>
<process id="process7edeefc38" taskpriority="0" logused="0" waitresource="PAGE: 5:1:196655 " waittime="3119" ownerId="2642852529" transactionname="user_transaction" lasttranstarted="2014-09-05T11:16:12.973" XDES="0x87f3ddbb0" lockMode="U" schedulerid="2" kpid="5216" status="suspended" spid="62" sbid="1" ecid="2" priority="0" trancount="0" lastbatchstarted="2014-09-05T11:16:12.980" lastbatchcompleted="2014-09-05T11:16:12.973" lastattention="1900-01-01T00:00:00.973" clientapp="WIRELESS LOCALIZATION SYSTEM 1.15.0" hostname="S-ITCS-ORTUNG" hostpid="1308" isolationlevel="read committed (2)" xactid="2642852529" currentdb="5" lockTimeout="4294967295" clientoption1="671088672" clientoption2="128056">
<executionStack>
<frame procname="adhoc" line="1" stmtstart="94" sqlhandle="0x020000008e714d2c0ee98fc35b8a7712a719321f42c9366a0000000000000000000000000000000000000000">
DELETE [statisticlog] WHERE [statisticid]=@1 AND [storageid]=@2 AND [timest]<@3 </frame>
<frame procname="adhoc" line="1" sqlhandle="0x02000000dd48f433f7e565ecccaaf5283c2e99548dd371d20000000000000000000000000000000000000000">
DELETE from statisticlog where ((statisticid='GWConnect') and (storageid='17:85:00:00:19:c8.0')) AND timest < {ts '1970-01-01 01:00:00.000' } </frame>
</executionStack>
<inputbuf>
DELETE from statisticlog where ((statisticid='GWConnect') and (storageid='17:85:00:00:19:c8.0')) AND timest < {ts '1970-01-01 01:00:00.000' } </inputbuf>
</process>
<process id="process681871868" taskpriority="0" logused="0" waitresource="PAGE: 5:1:210559 " waittime="3118" ownerId="2642852529" transactionname="user_transaction" lasttranstarted="2014-09-05T11:16:12.973" XDES="0x87bb39740" lockMode="U" schedulerid="1" kpid="8088" status="suspended" spid="62" sbid="1" ecid="3" priority="0" trancount="0" lastbatchstarted="2014-09-05T11:16:12.980" lastbatchcompleted="2014-09-05T11:16:12.973" lastattention="1900-01-01T00:00:00.973" clientapp="WIRELESS LOCALIZATION SYSTEM 1.15.0" hostname="S-ITCS-ORTUNG" hostpid="1308" isolationlevel="read committed (2)" xactid="2642852529" currentdb="5" lockTimeout="4294967295" clientoption1="671088672" clientoption2="128056">
<executionStack>
<frame procname="adhoc" line="1" stmtstart="94" sqlhandle="0x020000008e714d2c0ee98fc35b8a7712a719321f42c9366a0000000000000000000000000000000000000000">
DELETE [statisticlog] WHERE [statisticid]=@1 AND [storageid]=@2 AND [timest]<@3 </frame>
<frame procname="adhoc" line="1" sqlhandle="0x02000000dd48f433f7e565ecccaaf5283c2e99548dd371d20000000000000000000000000000000000000000">
DELETE from statisticlog where ((statisticid='GWConnect') and (storageid='17:85:00:00:19:c8.0')) AND timest < {ts '1970-01-01 01:00:00.000' } </frame>
</executionStack>
<inputbuf>
DELETE from statisticlog where ((statisticid='GWConnect') and (storageid='17:85:00:00:19:c8.0')) AND timest < {ts '1970-01-01 01:00:00.000' } </inputbuf>
</process>
<process id="process6e959f0c8" taskpriority="0" logused="10000" waittime="3087" schedulerid="4" kpid="6624" status="suspended" spid="62" sbid="1" ecid="0" priority="0" trancount="2" lastbatchstarted="2014-09-05T11:16:12.980" lastbatchcompleted="2014-09-05T11:16:12.973" lastattention="1900-01-01T00:00:00.973" clientapp="WIRELESS LOCALIZATION SYSTEM 1.15.0" hostname="S-ITCS-ORTUNG" hostpid="1308" loginname="LocSystem" isolationlevel="read committed (2)" xactid="2642852529" currentdb="5" lockTimeout="4294967295" clientoption1="671088672" clientoption2="128056">
<executionStack>
<frame procname="adhoc" line="1" stmtstart="94" sqlhandle="0x020000008e714d2c0ee98fc35b8a7712a719321f42c9366a0000000000000000000000000000000000000000">
DELETE [statisticlog] WHERE [statisticid]=@1 AND [storageid]=@2 AND [timest]<@3 </frame>
<frame procname="adhoc" line="1" sqlhandle="0x02000000dd48f433f7e565ecccaaf5283c2e99548dd371d20000000000000000000000000000000000000000">
DELETE from statisticlog where ((statisticid='GWConnect') and (storageid='17:85:00:00:19:c8.0')) AND timest < {ts '1970-01-01 01:00:00.000' } </frame>
</executionStack>
<inputbuf>
DELETE from statisticlog where ((statisticid='GWConnect') and (storageid='17:85:00:00:19:c8.0')) AND timest < {ts '1970-01-01 01:00:00.000' } </inputbuf>
</process>
</process-list>
<resource-list>
<pagelock fileid="1" pageid="210559" dbid="5" subresource="FULL" objectname="LocSystem.LocSystem.statisticlog" id="lock707200480" mode="U" associatedObjectId="72057594045464576">
<owner-list>
<owner id="process6e959f0c8" mode="U" />
</owner-list>
<waiter-list>
<waiter id="process56d746188" mode="U" requestType="wait" />
</waiter-list>
</pagelock>
<pagelock fileid="1" pageid="196655" dbid="5" subresource="FULL" objectname="LocSystem.LocSystem.statisticlog" id="lock6ddb9e400" mode="U" associatedObjectId="72057594045464576">
<owner-list>
<owner id="process681871868" mode="U" />
</owner-list>
<waiter-list>
<waiter id="process7edeee188" mode="U" requestType="wait" />
</waiter-list>
</pagelock>
<pagelock fileid="1" pageid="196655" dbid="5" subresource="FULL" objectname="LocSystem.LocSystem.statisticlog" id="lock6ddb9e400" mode="U" associatedObjectId="72057594045464576">
<owner-list>
<owner id="process7edeee188" mode="U" requestType="wait" />
</owner-list>
<waiter-list>
<waiter id="process7edeefc38" mode="U" requestType="wait" />
</waiter-list>
</pagelock>
<pagelock fileid="1" pageid="210559" dbid="5" subresource="FULL" objectname="LocSystem.LocSystem.statisticlog" id="lock707200480" mode="U" associatedObjectId="72057594045464576">
<owner-list>
<owner id="process56d746188" mode="U" requestType="wait" />
</owner-list>
<waiter-list>
<waiter id="process681871868" mode="U" requestType="wait" />
</waiter-list>
</pagelock>
<exchangeEvent id="Pipe59935a700" WaitType="e_waitPipeGetRow" nodeId="1">
<owner-list>
<owner id="process7edeefc38" />
<owner id="process681871868" />
</owner-list>
<waiter-list>
<waiter id="process6e959f0c8" />
</waiter-list>
</exchangeEvent>
</resource-list>
</deadlock>
>1. Is this expected behaviour or should SQL Server be able to handle such requests, or to put it right do I have to >care for structures that avoid the above scenario, do I have to reconfigure or is there sth else to look at?
Basically yes. Because your queries are non-trivial the DELETE query plans for different queries may conflict.
>2. Is this a configuration problem?
It's influenced by your table indexing, and especially how well your DELETE statements are supported by the physical data structures in your table. The bigger and more complicated the physical design, the more likely that concurrent DELETES will conflict.
>3. I also do not understand why the report states that the processes fought for page ids when the lock escalation >type was set to table.
Page locks are never the result of lock escalation. Row locks escalate to Table locks. Period. When a query uses Page locks it's an optimization to avoid taking lots of row locks to begin with. But this comes at the possible cost
of some concurrency. The
ROWLOCK query hint, possibly along with the READPAST hint can force more granular locking.
>4. As far as I got to know until now having a clustered index on the timestamp colum is likely to boost my problem >rather than solving it?
You minimize the locking conflicts by ensuring that it's very simple to find the rows affected by your DELETE. There's not enough information here to speculate on which physical design (partition scheme, clustered index, non-clustered indexes...) is optimal
for this.
A threshold question is whether you really _need_ these deletes to run concurrently on the table. If not, then you can simply serialize them (eg with TABLOCK).
David
David http://blogs.msdn.com/b/dbrowne/
Similar Messages
-
Using DATA_CELL and multiple queries into one table
Hi WAD experts,
I have been trying to work out how to combine multiple hidden query result sets in their own tables in the template, into one table displayed as if the data originated from one query.
I have been looking at using the DATA_CELL method of "modify table" class.
Has anyone had to do this before - and if so do you have any clues as to how best to do this ?
Thanks
ChrisHere is what I want:
Say I have a query that tells me about how many items were sold at a hardware store for each week. Then the output would look something like this:
Week,Item,Num_Sold
13,Hammer,15
13,Nail,594
13,Screw,398
14,Hammer,16
14,Nail,382
14,Screw,331
But I want my output to look like this:
<space>,13,14 <-- these would be the week numbers
Hammer,15,16
Nail,594,382
Screw,398,331
I asked this same question in a SQL-only forum and one person responded that they did not know how to do that. But I figure that this is done often enough that there must be some Open Source program that can transform the output data into a table. As you can see, it's not a pure transform. It's more like I take one column, make that the x-axis, another column, make that the y-axis, and "plot" the data based on the two columns. It's kinda like taking 1D data and making it 2D. There's no existing open source program which does this? I figure that I could just give the program my SQL queries, specify some rule such as "Make the first column of the resultset the row, make the second column the column and create a table with the 3rd row, using the first two rows to map the 3rd row into the table". Note that I think this only works with 3 columns.
Anyway, if there is no simple program that already does this, I can make a program to do what I just described. I just asked the question here because I figure that there are a lot of people knowledgeable about SQL and Java on this forum and that someone would know of a tool which already does what I want if one exists. -
Deleting rows from one table while filter condition lies into another table
Hi All,
I'm facing a problem deleting a row from a table where the condition lies in other table. To ealaborate the scenario further let's say I have two table T1 (transaction table) and T2 (Master Table). I want to delete a record from table T1 by checking some conditions lies in table T2.
I tried with the below query but this query deleting records from both the table.
DELETE FROM ( SELECT * FROM T1 top INNER JOIN T2 tp
ON top.TID = tp.TID
WHERE top.DEAL_SITE_ID = inputparameter1
AND (TP.SEGMENT <>inputparameter2 OR tp.segment is not null));
Here the record is getting deleted from both the tables but I don't want to delete data from my master table i.e table T2.
Any help would be highly appreciated. Thanks in advance.
Regards,
SubhadeepSQL> select *
2 from the_table;
X Y
AA a
BB a
CC a
AA b
DD b
SQL> select *
2 from the_table_2;
X Y
AA a
BB a
CC a
SQL> delete from
2 (
3 select *
4 from the_table t1 inner join the_table_2 t2
5 on t1.x = t2.x
6 and t1.y = t2.y);
3 rows deleted.
SQL> select *
2 from the_table;
X Y
AA b
DD b
SQL> select *
2 from the_table_2;
X Y
AA a
BB a
CC a -
Multiple Queries on one table....
Hi - I am trying to query the same table multiple times and can't figure out how any help would be GREATLY appreciated!! For example - I have a PRINRPT.CALL_DATE Field and in my SQL Command Statement I have asked it to only bring over PRINRPT.CALL_DATE > 10/31/08...I then count those on my report BUT I would also like to query that same table again with PRINRPT.CALL_DATE = Today - 90 Days and then again PRINRPT.CALL_DATE from 10/31/07 to 10/31/08....I can not figure out how to do this in CR. I tried a formula based on the PRINRPT.CALL_DATE field - but it only returns TRUE or FALSE..I would like actual dates so I can count them in the report to get a total by principal by customer (see below).
Here is my SQL Query - let me know if it is possible please!!! Thanks in advance for all of your help!!
Misty
SELECT ACCT_CLASS.NAME
, ACCT_CLASS.PRIN_NAME
, PRINRPRT.PRIN_NAME, PRINRPRT.CALL_DATE, PRINRPRT.AUTHOR
, CUSTOMER.SALES_Name
, CUSTOMER.SALES_NO
, CUSTOMER.NAME
, CUSTOMER.Customer_Class
, ACCT_CLASS.CLASSIFICATION
, PROJECTS.PRIN_NAME
, PROJECTS.EST_PROF
, SALES.PRIN_NAME
, SALES.NOV_2008_GP, SALES.DEC_2008_GP, SALES.JAN_2009_GP,
SALES.FEB_2009_GP, SALES.MAR_2009_GP, SALES.APR_2009_GP,
SALES.MAY_2009_GP, SALES.JUN_2009_GP, SALES.JUL_2009_GP,
SALES.AUG_2009_GP, SALES.SEP_2009_GP, SALES.OCT_2009_GP,
SALES.NOV_2007_GP, SALES.DEC_2007_GP, SALES.JAN_2008_GP,
SALES.FEB_2008_GP, SALES.MAR_2008_GP, SALES.APR_2008_GP,
SALES.MAY_2008_GP, SALES.JUN_2008_GP, SALES.JUL_2008_GP,
SALES.AUG_2008_GP, SALES.SEP_2008_GP, SALES.OCT_2008_GP
FROM AveWorking.dbo.ACCT_CLASS
JOIN AveWorking.dbo.CUSTOMER ON ACCT_CLASS.CUSTOMER_ID = CUSTOMER.CUSTOMER_ID
LEFT JOIN AveWorking.dbo.PRINRPRT ON ACCT_CLASS.PRIN_NAME = PRINRPRT.PRIN_NAME
AND ACCT_CLASS.CUSTOMER_ID = PRINRPRT.CUSTOMER_ID
AND ACCT_CLASS.NAME = PRINRPRT.NAME
AND PRINRPRT.CALL_DATE > 10/31/2008
LEFT JOIN AveWorking.dbo.PROJECTS ON CUSTOMER.CUSTOMER_ID = PROJECTS.CUSTOMER_ID
AND PROJECTS.NAME = PRINRPRT.NAME
AND PROJECTS.PRIN_NAME = PRINRPRT.PRIN_NAME
LEFT JOIN AveWorking.dbo.SALES ON PRINRPRT.PRIN_NAME = SALES.PRIN_NAME
AND SALES.CUSTOMER_ID = PRINRPRT.CUSTOMER_ID
ORDER BY CUSTOMER.SALES_Name, ACCT_CLASS.PRIN_NAME,PRINRPRT.PRIN_NAME,PROJECTS.PRIN_NAMEThanks so much Carl - that was it...I think I have been staring at this for far too many hours now and can't see what is right in front of me!!
I am still having more issues with it - I hate this report!!!! I am getting duplicate dates & sales populating now. So for example I want:
Principal Name Name sales 09 Sales 08 Dates 3Mo Dates 09 Date 08
So, I am getting Sales 09 & Sales 08 and Dates in 09 coming up multiple times per customer where there really is only one showing in the database for each day. I think it has something to do with the sales connection (the last Left Join on my report). I have ran it soooo many times with groups, without groups, inside out and upside down etc....but if I need an accurate count of the calls made in each column I can't have it duplicating dates...can you tell from my query as to why it might do this???
My ultimate goal is to have one line of data per data field above, then repeat for a new customer.
Any more ideas????
Principal Name Name sales 09 Sales 08 Dates 3Mo Dates 09 Date 08
XXXX XXXXX Total $ Total $ # # #
Thanks again so much, any help you can give is greatly appreciated!!
Misty
Current Query:
select ACCT_CLASS.NAME
, ACCT_CLASS.PRIN_NAME
, PRINRPRT.PRIN_NAME, PRINRPRT.AUTHOR
, CUSTOMER.SALES_Name
, CUSTOMER.SALES_NO
, CUSTOMER.NAME
, CUSTOMER.Customer_Class
, ACCT_CLASS.CLASSIFICATION
, PROJECTS.PRIN_NAME
, PROJECTS.EST_PROF
, SALES.PRIN_NAME
, SALES.NOV_2008_GP, SALES.DEC_2008_GP, SALES.JAN_2009_GP,
SALES.FEB_2009_GP, SALES.MAR_2009_GP, SALES.APR_2009_GP,
SALES.MAY_2009_GP, SALES.JUN_2009_GP, SALES.JUL_2009_GP,
SALES.AUG_2009_GP, SALES.SEP_2009_GP, SALES.OCT_2009_GP,
SALES.NOV_2007_GP, SALES.DEC_2007_GP, SALES.JAN_2008_GP,
SALES.FEB_2008_GP, SALES.MAR_2008_GP, SALES.APR_2008_GP,
SALES.MAY_2008_GP, SALES.JUN_2008_GP, SALES.JUL_2008_GP,
SALES.AUG_2008_GP, SALES.SEP_2008_GP, SALES.OCT_2008_GP,
PRINRPRT.CALL_DATE,
case when PRINRPRT.CALL_DATE BETWEEN '11/01/2008' AND '10/31/2009' then PRINRPRT.CALL_DATE ELSE NULL end as "Call_Dates09",
case when PRINRPRT.CALL_DATE > getdate() - 90 then PRINRPRT.CALL_DATE ELSE NULL end as "3MOCall_Dates09",
case when PRINRPRT.CALL_DATE BETWEEN '11/01/2007' AND '10/31/2008' THEN PRINRPRT.CALL_DATE ELSE NULL END "CALL_DATES08"
FROM AveWorking.dbo.ACCT_CLASS
JOIN AveWorking.dbo.CUSTOMER ON ACCT_CLASS.CUSTOMER_ID = CUSTOMER.CUSTOMER_ID
LEFT JOIN AveWorking.dbo.PRINRPRT ON ACCT_CLASS.PRIN_NAME = PRINRPRT.PRIN_NAME
AND ACCT_CLASS.CUSTOMER_ID = PRINRPRT.CUSTOMER_ID
AND ACCT_CLASS.NAME = PRINRPRT.NAME
LEFT JOIN AveWorking.dbo.PROJECTS ON CUSTOMER.CUSTOMER_ID = PROJECTS.CUSTOMER_ID
AND PROJECTS.NAME = PRINRPRT.NAME
AND PROJECTS.PRIN_NAME = PRINRPRT.PRIN_NAME
LEFT JOIN AveWorking.dbo.SALES ON CUSTOMER.CUSTOMER_ID = SALES.CUSTOMER_ID
AND ACCT_CLASS.PRIN_NAME = SALES.PRIN_NAME
AND ACCT_CLASS.NAME = SALES.NAME
ORDER BY CUSTOMER.SALES_Name, ACCT_CLASS.PRIN_NAME,PRINRPRT.PRIN_NAME,PROJECTS.PRIN_NAME
Edited by: Misty Whitney on Jul 28, 2009 3:07 PM -
Multiple BI Query Results into one Table
Hi All
Can I embed Multiple queries into one table using VC?
I have data in different BI sources(Info Areas) like sales and distribution,Shipments etc. Can I write any universal query to retrive data from multiple sources?(If any???)Hi Jan Pasha,
My model contains two BW queries which uses UNION and sent result to one table.
I tried using UNION also but when I use it I am able to see no records to select in result table.
I donot have any coloums in common. Is it pre-requisite for using UNION? -
How to delete the double records connected to one or more than one tables in SQL 2008?
Hi
Can anyone please help me with the SQL query. I Im having a table called People with columns names: personno., lastname, firstname and so on. The personno. is having duplicate records,so all the duplicate records i have written with "double" in
the beginning of the numbers. I tried deleting these double records but they are linked to one or more than one tables. I have to find out, all the tables blocking the deleting of double person. And then create select statements which creates update statements
in order to replace the current id of double person with substitute id. (The personno. is in the form of id's in the database)
ThanksYou should not append "double" in the personno. When we append it will not be able to join or relate to other table. Keep the id as it is and use another field(STATUS) to mark as duplicate. Also we will require another field(PRIMARYID) against
those duplicate rows i.e the main or the primary personno.
SELECT * FROM OtherTable a INNER JOIN
(SELECT personno, status, primaryid FROM PEOPLE WHERE status = 'Duplicate') b
ON a.personno = b.personno
UPDATE OtherTable SET personno = b.primaryid
FROM OtherTable a INNER JOIN
(SELECT personno, status, primaryid FROM PEOPLE WHERE status = 'Duplicate') b
ON a.personno = b.personno
NOTE: Please take backup before applying the query. This is not tested.
Regards, RSingh -
How to delete the row in table control with respect to one field in module pool programming?
Hi,
Can I know the way to delete the row in table control with respect to one field in module pool programming
Regards
Darshan MSHI,
I want to delete the row after the display of table control. I have created push button as delete row. If I click on this push button, the selected row should get deleted.
I have written this code,
module USER_COMMAND_9000 input.
DATA OK_CODE TYPE SY-UCOMM.
OK_CODE = SY-UCOMM.
CASE OK_CODE.
WHEN 'DELETE'.
LOOP AT lt_source INTO ls_source WHERE mark = 'X'.
APPEND LS_SOURCE TO LT_RESTORE.
DELETE TABLE LT_SOURCE FROM LS_SOURCE.
SOURCE-LINES = SOURCE-LINES - 1.
ENDLOOP.
But I'm unable to delete the selected rows, It is getting deleted the last rows eventhough I select the other row.
So I thought of doing with respect to the field. -
How to improve speed of queries that use ORM one table per concrete class
Hi,
Many tools that make ORM (Object Relational Mapping) like Castor, Hibernate, Toplink, JPOX, etc.., have the one table per concrete class feature that maps objects to follow structure:
CREATE TABLE ABSTRACTPRODUCT (
ID VARCHAR(8) NOT NULL,
DESCRIPTION VARCHAR(60) NOT NULL,
PRIMARY KEY(ID)
CREATE TABLE PRODUCT (
ID VARCHAR(8) NOT NULL REFERENCES ABSTRACTPRODUCT(ID),
CODE VARCHAR(10) NOT NULL,
PRICE DECIMAL(12,2),
PRIMARY KEY(ID)
CREATE UNIQUE INDEX iProduct ON Product(code)
CREATE TABLE BOOK (
ID VARCHAR(8) NOT NULL REFERENCES PRODUCT(ID),
AUTHOR VARCHAR(60) NOT NULL,
PRIMARY KEY (ID)
CREATE TABLE COMPACTDISK (
ID VARCHAR(8) NOT NULL REFERENCES PRODUCT(ID),
ARTIST VARCHAR(60) NOT NULL,
PRIMARY KEY(ID)
there is a way to improve queries like
SELECT
pd.code CODE,
abpd.description DESCRIPTION,
DECODE(bk.id,NULL,cd.artist,bk.author) PERSON
FROM
ABSTRACTPRODUCT abpd,
PRODUCT pd,
BOOK bk,
COMPACTDISK cd
WHERE
pd.id = abpd.id AND
bk.id(+) = abpd.id AND
cd.id(+) = abpd.id AND
pd.code like '101%'
or like this:
SELECT
pd.code CODE,
abpd.description DESCRIPTION,
DECODE(bk.id,NULL,cd.artist,bk.author) PERSON
FROM
ABSTRACTPRODUCT abpd,
PRODUCT pd,
BOOK bk,
COMPACTDISK cd
WHERE
pd.id = abpd.id AND
bk.id(+) = abpd.id AND
cd.id(+) = abpd.id AND
abpd.description like '%STARS%' AND
pd.price BETWEEN 1 AND 10
think in a table with many rows, then exists something inside MaxDB to improve this type of queries? like some anotations on SQL? or declare tables that extends another by PK? on other databases i managed this using Materialized Views, but i think that this can be faster just using PK, i'm wrong? the better is to consolidate all tables in one table? what is the impact on database size with this consolidation?
note: with consolidation i will miss NOT NULL constraint at database side.
thanks for any insight.
ClóvisHi Lars,
i dont understand because the optimizer get that Index for TM at execution plan, and because dont use the join via KEY column, note the WHERE clause is "TM.OID = MF.MY_TIPO_MOVIMENTO" by the key column, and the optimizer uses an INDEX that the indexed column is ID_SYS, that isnt and cant be a primary key, because its not UNIQUE, follow the index columns:
indexes of TipoMovimento
INDEXNAME COLUMNNAME SORT COLUMNNO DATATYPE LEN INDEX_USED FILESTATE DISABLED
ITIPOMOVIMENTO TIPO ASC 1 VARCHAR 2 220546 OK NO
ITIPOMOVIMENTO ID_SYS ASC 2 CHAR 6 220546 OK NO
ITIPOMOVIMENTO MY_CONTA_DEBITO ASC 3 CHAR 8 220546 OK NO
ITIPOMOVIMENTO MY_CONTA_CREDITO ASC 4 CHAR 8 220546 OK NO
ITIPOMOVIMENTO1 ID_SYS ASC 1 CHAR 6 567358 OK NO
ITIPOMOVIMENTO2 DESCRICAO ASC 1 VARCHAR 60 94692 OK NO
after i create the index iTituloCobrancaX7 on TituloCobranca(OID,DATA_VENCIMENTO) in a backup instance and get surprised with the follow explain:
OWNER TABLENAME COLUMN_OR_INDEX STRATEGY PAGECOUNT
TC ITITULOCOBRANCA1 RANGE CONDITION FOR INDEX 5368
DATA_VENCIMENTO (USED INDEX COLUMN)
MF OID JOIN VIA KEY COLUMN 9427
TM OID JOIN VIA KEY COLUMN 22
TABLE HASHED
PS OID JOIN VIA KEY COLUMN 1350
BOL OID JOIN VIA KEY COLUMN 497
NO TEMPORARY RESULTS CREATED
JDBC_CURSOR_19 RESULT IS COPIED , COSTVALUE IS 988
note that now the optimizer gets the index ITITULOCOBRANCA1 as i expected, if i drop the new index iTituloCobrancaX7 the optimizer still getting this execution plan, with this the query executes at 110 ms, with that great news i do same thing in the production system, but the execution plan dont changes, and i still getting a long execution time this time at 413516 ms. maybe the problem is how optimizer measure my tables.
i checked in DBAnalyser that the problem is catalog cache hit rate (we discussed this at [catalog cache hit rate, how to increase?|;
) and the low selectivity of this SQL command, then its because of this that to achieve a better selectivity i must have an index with, MF.MY_SACADO, MF.TIPO and TC.DATA_VENCIMENTO, as explained in previous posts, since this type of index inside MaxDB isnt possible, i have no choice to speed this type of query without changing tables structure.
MaxDB developers can develop this type of index? or a feature like this dont have any plans to be made?
if no, i must create another schema, to consolidate tables to speed queries on my system, but with this consolidation i will get more overhead, i must solve the less selectivity because i think if the data on tables increase, the query becomes impossible, i see that CREATE INDEX supports FUNCTION, maybe a FUNCTION that join data of two tables can solve this?
about instance configuration it is:
Machine:
Version: '64BIT Kernel'
Version: 'X64/LIX86 7.6.03 Build 007-123-157-515'
Version: 'FAST'
Machine: 'x86_64'
Processors: 2 ( logical: 8, cores: 8 )
data volumes:
ID MODE CONFIGUREDSIZE USABLESIZE USEDSIZE USEDSIZEPERCENTAGE DROPVOLUME TOTALCLUSTERAREASIZE RESERVEDCLUSTERAREASIZE USEDCLUSTERAREASIZE PATH
1 NORMAL 4194304 4194288 379464 9 NO 0 0 0 /db/SPDT/data/data01.dat
2 NORMAL 4194304 4194288 380432 9 NO 0 0 0 /db/SPDT/data/data02.dat
3 NORMAL 4194304 4194288 379184 9 NO 0 0 0 /db/SPDT/data/data03.dat
4 NORMAL 4194304 4194288 379624 9 NO 0 0 0 /db/SPDT/data/data04.dat
5 NORMAL 4194304 4194288 380024 9 NO 0 0 0 /db/SPDT/data/data05.dat
log volumes:
ID CONFIGUREDSIZE USABLESIZE PATH MIRRORPATH
1 51200 51176 /db/SPDT/log/log01.dat ?
parameters:
KERNELVERSION KERNEL 7.6.03 BUILD 007-123-157-515
INSTANCE_TYPE OLTP
MCOD NO
_SERVERDB_FOR_SAP YES
_UNICODE NO
DEFAULT_CODE ASCII
DATE_TIME_FORMAT ISO
CONTROLUSERID DBM
CONTROLPASSWORD
MAXLOGVOLUMES 2
MAXDATAVOLUMES 11
LOG_VOLUME_NAME_001 /db/SPDT/log/log01.dat
LOG_VOLUME_TYPE_001 F
LOG_VOLUME_SIZE_001 6400
DATA_VOLUME_NAME_0005 /db/SPDT/data/data05.dat
DATA_VOLUME_NAME_0004 /db/SPDT/data/data04.dat
DATA_VOLUME_NAME_0003 /db/SPDT/data/data03.dat
DATA_VOLUME_NAME_0002 /db/SPDT/data/data02.dat
DATA_VOLUME_NAME_0001 /db/SPDT/data/data01.dat
DATA_VOLUME_TYPE_0005 F
DATA_VOLUME_TYPE_0004 F
DATA_VOLUME_TYPE_0003 F
DATA_VOLUME_TYPE_0002 F
DATA_VOLUME_TYPE_0001 F
DATA_VOLUME_SIZE_0005 524288
DATA_VOLUME_SIZE_0004 524288
DATA_VOLUME_SIZE_0003 524288
DATA_VOLUME_SIZE_0002 524288
DATA_VOLUME_SIZE_0001 524288
DATA_VOLUME_MODE_0005 NORMAL
DATA_VOLUME_MODE_0004 NORMAL
DATA_VOLUME_MODE_0003 NORMAL
DATA_VOLUME_MODE_0002 NORMAL
DATA_VOLUME_MODE_0001 NORMAL
DATA_VOLUME_GROUPS 1
LOG_BACKUP_TO_PIPE NO
MAXBACKUPDEVS 2
LOG_MIRRORED NO
MAXVOLUMES 14
LOG_IO_BLOCK_COUNT 8
DATA_IO_BLOCK_COUNT 64
BACKUP_BLOCK_CNT 64
_DELAY_LOGWRITER 0
LOG_IO_QUEUE 50
_RESTART_TIME 600
MAXCPU 8
MAX_LOG_QUEUE_COUNT 0
USED_MAX_LOG_QUEUE_COUNT 8
LOG_QUEUE_COUNT 1
MAXUSERTASKS 500
_TRANS_RGNS 8
_TAB_RGNS 8
_OMS_REGIONS 0
_OMS_RGNS 7
OMS_HEAP_LIMIT 0
OMS_HEAP_COUNT 8
OMS_HEAP_BLOCKSIZE 10000
OMS_HEAP_THRESHOLD 100
OMS_VERS_THRESHOLD 2097152
HEAP_CHECK_LEVEL 0
_ROW_RGNS 8
RESERVEDSERVERTASKS 16
MINSERVERTASKS 28
MAXSERVERTASKS 28
_MAXGARBAGE_COLL 1
_MAXTRANS 4008
MAXLOCKS 120080
_LOCK_SUPPLY_BLOCK 100
DEADLOCK_DETECTION 4
SESSION_TIMEOUT 180
OMS_STREAM_TIMEOUT 30
REQUEST_TIMEOUT 5000
_IOPROCS_PER_DEV 2
_IOPROCS_FOR_PRIO 0
_IOPROCS_FOR_READER 0
_USE_IOPROCS_ONLY NO
_IOPROCS_SWITCH 2
LRU_FOR_SCAN NO
_PAGE_SIZE 8192
_PACKET_SIZE 131072
_MINREPLY_SIZE 4096
_MBLOCK_DATA_SIZE 32768
_MBLOCK_QUAL_SIZE 32768
_MBLOCK_STACK_SIZE 32768
_MBLOCK_STRAT_SIZE 16384
_WORKSTACK_SIZE 8192
_WORKDATA_SIZE 8192
_CAT_CACHE_MINSIZE 262144
CAT_CACHE_SUPPLY 131072
INIT_ALLOCATORSIZE 262144
ALLOW_MULTIPLE_SERVERTASK_UKTS NO
_TASKCLUSTER_01 tw;al;ut;2000*sv,100*bup;10*ev,10*gc;
_TASKCLUSTER_02 ti,100*dw;63*us;
_TASKCLUSTER_03 equalize
_DYN_TASK_STACK NO
_MP_RGN_QUEUE YES
_MP_RGN_DIRTY_READ DEFAULT
_MP_RGN_BUSY_WAIT DEFAULT
_MP_DISP_LOOPS 2
_MP_DISP_PRIO DEFAULT
MP_RGN_LOOP -1
_MP_RGN_PRIO DEFAULT
MAXRGN_REQUEST -1
_PRIO_BASE_U2U 100
_PRIO_BASE_IOC 80
_PRIO_BASE_RAV 80
_PRIO_BASE_REX 40
_PRIO_BASE_COM 10
_PRIO_FACTOR 80
_DELAY_COMMIT NO
_MAXTASK_STACK 512
MAX_SERVERTASK_STACK 500
MAX_SPECIALTASK_STACK 500
_DW_IO_AREA_SIZE 50
_DW_IO_AREA_FLUSH 50
FBM_VOLUME_COMPRESSION 50
FBM_VOLUME_BALANCE 10
_FBM_LOW_IO_RATE 10
CACHE_SIZE 262144
_DW_LRU_TAIL_FLUSH 25
XP_DATA_CACHE_RGNS 0
_DATA_CACHE_RGNS 64
XP_CONVERTER_REGIONS 0
CONVERTER_REGIONS 8
XP_MAXPAGER 0
MAXPAGER 64
SEQUENCE_CACHE 1
_IDXFILE_LIST_SIZE 2048
VOLUMENO_BIT_COUNT 8
OPTIM_MAX_MERGE 500
OPTIM_INV_ONLY YES
OPTIM_CACHE NO
OPTIM_JOIN_FETCH 0
JOIN_SEARCH_LEVEL 0
JOIN_MAXTAB_LEVEL4 16
JOIN_MAXTAB_LEVEL9 5
_READAHEAD_BLOBS 32
CLUSTER_WRITE_THRESHOLD 80
CLUSTERED_LOBS NO
RUNDIRECTORY /var/opt/sdb/data/wrk/SPDT
OPMSG1 /dev/console
OPMSG2 /dev/null
_KERNELDIAGFILE knldiag
KERNELDIAGSIZE 800
_EVENTFILE knldiag.evt
_EVENTSIZE 0
_MAXEVENTTASKS 2
_MAXEVENTS 100
_KERNELTRACEFILE knltrace
TRACE_PAGES_TI 2
TRACE_PAGES_GC 20
TRACE_PAGES_LW 5
TRACE_PAGES_PG 3
TRACE_PAGES_US 10
TRACE_PAGES_UT 5
TRACE_PAGES_SV 5
TRACE_PAGES_EV 2
TRACE_PAGES_BUP 0
KERNELTRACESIZE 5369
EXTERNAL_DUMP_REQUEST NO
_AK_DUMP_ALLOWED YES
_KERNELDUMPFILE knldump
_RTEDUMPFILE rtedump
_UTILITY_PROTFILE dbm.utl
UTILITY_PROTSIZE 100
_BACKUP_HISTFILE dbm.knl
_BACKUP_MED_DEF dbm.mdf
_MAX_MESSAGE_FILES 0
_SHMKERNEL 44601
__PARAM_CHANGED___ 0
__PARAM_VERIFIED__ 2008-05-03 23:12:55
DIAG_HISTORY_NUM 2
DIAG_HISTORY_PATH /var/opt/sdb/data/wrk/SPDT/DIAGHISTORY
_DIAG_SEM 1
SHOW_MAX_STACK_USE NO
SHOW_MAX_KB_STACK_USE NO
LOG_SEGMENT_SIZE 2133
_COMMENT
SUPPRESS_CORE YES
FORMATTING_MODE PARALLEL
FORMAT_DATAVOLUME YES
OFFICIAL_NODE
UKT_CPU_RELATIONSHIP NONE
HIRES_TIMER_TYPE CPU
LOAD_BALANCING_CHK 30
LOAD_BALANCING_DIF 10
LOAD_BALANCING_EQ 5
HS_STORAGE_DLL libhsscopy
HS_SYNC_INTERVAL 50
USE_OPEN_DIRECT YES
USE_OPEN_DIRECT_FOR_BACKUP NO
SYMBOL_DEMANGLING NO
EXPAND_COM_TRACE NO
JOIN_TABLEBUFFER 128
SET_VOLUME_LOCK YES
SHAREDSQL YES
SHAREDSQL_CLEANUPTHRESHOLD 25
SHAREDSQL_COMMANDCACHESIZE 262144
MEMORY_ALLOCATION_LIMIT 0
USE_SYSTEM_PAGE_CACHE YES
USE_COROUTINES YES
FORBID_LOAD_BALANCING YES
MIN_RETENTION_TIME 60
MAX_RETENTION_TIME 480
MAX_SINGLE_HASHTABLE_SIZE 512
MAX_HASHTABLE_MEMORY 5120
ENABLE_CHECK_INSTANCE YES
RTE_TEST_REGIONS 0
HASHED_RESULTSET YES
HASHED_RESULTSET_CACHESIZE 262144
CHECK_HASHED_RESULTSET 0
AUTO_RECREATE_BAD_INDEXES NO
AUTHENTICATION_ALLOW
AUTHENTICATION_DENY
TRACE_AK NO
TRACE_DEFAULT NO
TRACE_DELETE NO
TRACE_INDEX NO
TRACE_INSERT NO
TRACE_LOCK NO
TRACE_LONG NO
TRACE_OBJECT NO
TRACE_OBJECT_ADD NO
TRACE_OBJECT_ALTER NO
TRACE_OBJECT_FREE NO
TRACE_OBJECT_GET NO
TRACE_OPTIMIZE NO
TRACE_ORDER NO
TRACE_ORDER_STANDARD NO
TRACE_PAGES NO
TRACE_PRIMARY_TREE NO
TRACE_SELECT NO
TRACE_TIME NO
TRACE_UPDATE NO
TRACE_STOP_ERRORCODE 0
TRACE_ALLOCATOR 0
TRACE_CATALOG 0
TRACE_CLIENTKERNELCOM 0
TRACE_COMMON 0
TRACE_COMMUNICATION 0
TRACE_CONVERTER 0
TRACE_DATACHAIN 0
TRACE_DATACACHE 0
TRACE_DATAPAM 0
TRACE_DATATREE 0
TRACE_DATAINDEX 0
TRACE_DBPROC 0
TRACE_FBM 0
TRACE_FILEDIR 0
TRACE_FRAMECTRL 0
TRACE_IOMAN 0
TRACE_IPC 0
TRACE_JOIN 0
TRACE_KSQL 0
TRACE_LOGACTION 0
TRACE_LOGHISTORY 0
TRACE_LOGPAGE 0
TRACE_LOGTRANS 0
TRACE_LOGVOLUME 0
TRACE_MEMORY 0
TRACE_MESSAGES 0
TRACE_OBJECTCONTAINER 0
TRACE_OMS_CONTAINERDIR 0
TRACE_OMS_CONTEXT 0
TRACE_OMS_ERROR 0
TRACE_OMS_FLUSHCACHE 0
TRACE_OMS_INTERFACE 0
TRACE_OMS_KEY 0
TRACE_OMS_KEYRANGE 0
TRACE_OMS_LOCK 0
TRACE_OMS_MEMORY 0
TRACE_OMS_NEWOBJ 0
TRACE_OMS_SESSION 0
TRACE_OMS_STREAM 0
TRACE_OMS_VAROBJECT 0
TRACE_OMS_VERSION 0
TRACE_PAGER 0
TRACE_RUNTIME 0
TRACE_SHAREDSQL 0
TRACE_SQLMANAGER 0
TRACE_SRVTASKS 0
TRACE_SYNCHRONISATION 0
TRACE_SYSVIEW 0
TRACE_TABLE 0
TRACE_VOLUME 0
CHECK_BACKUP NO
CHECK_DATACACHE NO
CHECK_KB_REGIONS NO
CHECK_LOCK NO
CHECK_LOCK_SUPPLY NO
CHECK_REGIONS NO
CHECK_TASK_SPECIFIC_CATALOGCACHE NO
CHECK_TRANSLIST NO
CHECK_TREE NO
CHECK_TREE_LOCKS NO
CHECK_COMMON 0
CHECK_CONVERTER 0
CHECK_DATAPAGELOG 0
CHECK_DATAINDEX 0
CHECK_FBM 0
CHECK_IOMAN 0
CHECK_LOGHISTORY 0
CHECK_LOGPAGE 0
CHECK_LOGTRANS 0
CHECK_LOGVOLUME 0
CHECK_SRVTASKS 0
OPTIMIZE_AGGREGATION YES
OPTIMIZE_FETCH_REVERSE YES
OPTIMIZE_STAR_JOIN YES
OPTIMIZE_JOIN_ONEPHASE YES
OPTIMIZE_JOIN_OUTER YES
OPTIMIZE_MIN_MAX YES
OPTIMIZE_FIRST_ROWS YES
OPTIMIZE_OPERATOR_JOIN YES
OPTIMIZE_JOIN_HASHTABLE YES
OPTIMIZE_JOIN_HASH_MINIMAL_RATIO 1
OPTIMIZE_OPERATOR_JOIN_COSTFUNC YES
OPTIMIZE_JOIN_PARALLEL_MINSIZE 1000000
OPTIMIZE_JOIN_PARALLEL_SERVERS 0
OPTIMIZE_JOIN_OPERATOR_SORT YES
OPTIMIZE_QUAL_ON_INDEX YES
DDLTRIGGER YES
SUBTREE_LOCKS NO
MONITOR_READ 2147483647
MONITOR_TIME 2147483647
MONITOR_SELECTIVITY 0
MONITOR_ROWNO 0
CALLSTACKLEVEL 0
OMS_RUN_IN_UDE_SERVER NO
OPTIMIZE_QUERYREWRITE OPERATOR
TRACE_QUERYREWRITE 0
CHECK_QUERYREWRITE 0
PROTECT_DATACACHE_MEMORY NO
LOCAL_REDO_LOG_BUFFER_SIZE 0
FILEDIR_SPINLOCKPOOL_SIZE 10
TRANS_HISTORY_SIZE 0
TRANS_THRESHOLD_VALUE 60
ENABLE_SYSTEM_TRIGGERS YES
DBFILLINGABOVELIMIT 70L80M85M90H95H96H97H98H99H
DBFILLINGBELOWLIMIT 70L80L85L90L95L
LOGABOVELIMIT 50L75L90M95M96H97H98H99H
AUTOSAVE 1
BACKUPRESULT 1
CHECKDATA 1
EVENT 1
ADMIN 1
ONLINE 1
UPDSTATWANTED 1
OUTOFSESSIONS 3
ERROR 3
SYSTEMERROR 3
DATABASEFULL 1
LOGFULL 1
LOGSEGMENTFULL 1
STANDBY 1
USESELECTFETCH YES
USEVARIABLEINPUT NO
UPDATESTAT_PARALLEL_SERVERS 0
UPDATESTAT_SAMPLE_ALGO 1
SIMULATE_VECTORIO IF_OPEN_DIRECT_OR_RAW_DEVICE
COLUMNCOMPRESSION YES
TIME_MEASUREMENT NO
CHECK_TABLE_WIDTH NO
MAX_MESSAGE_LIST_LENGTH 100
SYMBOL_RESOLUTION YES
PREALLOCATE_IOWORKER NO
CACHE_IN_SHARED_MEMORY NO
INDEX_LEAF_CACHING 2
NO_SYNC_TO_DISK_WANTED NO
SPINLOCK_LOOP_COUNT 30000
SPINLOCK_BACKOFF_BASE 1
SPINLOCK_BACKOFF_FACTOR 2
SPINLOCK_BACKOFF_MAXIMUM 64
ROW_LOCKS_PER_TRANSACTION 50
USEUNICODECOLUMNCOMPRESSION NO
about send you the data from tables, i dont have permission to do that, since all data is in a production system, the customer dont give me the rights to send any information. sorry about that.
best regards
Clóvis -
Deleting and or moving multiple adhoc/SAP queries in one go.
Hi,
I am wondering whether anyone knows of a method to deleting multiple SAP queries in a single go. I would also like to be able to bulk move queries from one user group to another. We are having a wholesale clear-up of queries and the thought of having to do each one individually is scary!
Many thanks in advanceTo delete queries belonged to a user group, you can use SQ02 - GoTo - Query Directory, then key in the desired user group and execute. From the output list of this, you can select all queries and click on 'Delete Select Queries' .
-
How to cancel the alter or delete purview for one's scheme table?
I want to put down the user of some scheme table that is altered or deleted the field of its. But the scheme has the RESOURCE and CONNECT role for the user. I want to control the user can't delete or alter the table field.
How can to do ? urgent!!
Please tell me?
regard.I'm not sure I understand your question correctly. Are you looking to audit the DDL a particular user issues or are you looking to prevent that user from issuing certain types of DDL?
Justin -
Deleting data from a table where there are no indexes on the table
Hi
We have one interface program for one time process.When I was testing the process it was taking too much time to load the data around 1000 records.
it happens in 2 steps
1 puts into stage table
2 puts into base table
in the process/package I have delete statement that deletes data from stage table before each process.
Stage table did not have any indexes but the base table has(obvisiosly)
any idea?
please help me on this.
Thanks,
YHi,
Please post the application/database details along with the OS.
Is this interface program a seeded or custom one?
Please enable trace on this concurrent program as per (Note: 296559.1 - FAQ: Common Tracing Techniques within the Oracle Applications 11i/R12) and generate the TKPROF to find out why it takes that long to load/delete the data.
Thanks,
Hussein -
Reg:How to delete the column in table control also from database table.
Hi Experts,
Once again thank u all for giving the responses.
one more doubt is how to delete the columns of table control and also the record shold delete from ztable.
With Regards,
Saroja.P.Hi,
If you want to delete the rows in the table control and simultaneously delete it from the database table, then you can implement a 'DELETE' functionality specific to your table control. Have a MARK field (you will find that in the screen attributes of the table control -> give a name for the MARK field, you will find an additional MARK column at the beginning of your table control). You can check whatever rows you want to delete from the table control, call the delete module.
"This portion of code inside the LOOP...ENDLOOP.
IF sy-ucomm eq 'F_DELETE'.
gt_itab2-check = mark. " Store the MARK field status into your internal table's correspoding field 'check'
MODIFY gt_itab INDEX tabcontrol-current_line.
ENDIF.
iF sy-ucomm eq 'DELETE1'.
DELETE gt_itab WHERE check eq 'X'. "Your internal table does not have rows that you want to delete
ENDIF.
Now you can modify your database table using the MODIFY statement.
MODIFY ZDB FROM TABLE gt_itab. -
Creating SQL-Loader script for more than one table at a time
Hi,
I am using OMWB 2.0.2.0.0 with Oracle 8.1.7 and Sybase 11.9.
It looks like I can create SQL-Loader scripts for all the tables
or for one table at a time. If I want to create SQL-Loader
scripts for 5-6 tables, I have to either create script for all
the tables and then delete the unwanted tables or create the
scripts for one table at a time and then merge them.
Is there a simple way to create migration scripts for more than
one but not all tables at a time?
Thanks,
Prashant RaneNo there is no multi-select for creating SQL-Loader scripts.
You can either create them separately or create them all and
then discard the one you do not need. -
Moving time-dependant data from one table to another (archiving)
Hello all
I would like to know if there's an easier solution or a "best practice" to move data from one table to another. The context of this issue can be found within "archiving".
More concretely: we have an application that uses several tables to log information to.
These tables are growing like crazy, and we would like to keep only "relevant" data in those tables, so I was thinking about moving data from these tables that have been in there for, say 2 months, to "archiving" tables.
I figured there must be some kind of "best practice" to get this done.
I have already written a procedure that loops the table that has the time indicator and inserts the records from the normal tables into the archive tables (and afterwards delete this data), but it seems to be taking ages to get it done.
Thanks in advance!
Message was edited by:
timschraepenThere is nothing to do with PL/SQL.
You can refer below links:
http://www.lc.leidenuniv.nl/awcourse/oracle/server.920/a96524/c12parti.htm
http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10739/partiti.htm#i1006727 -
Moving data from one table to another
Hi,
I havent done CF in a log time and i have a question,
My client has an admin site for his inventory in a db (MS SQL) one of the table (inventory) has 180 fields (which are options for the items) with around 100 records that are being added/deleted per week, he now whants to keep the deleted data has reference to what happened to them.
What i want to do is move all the data berofe deleting the record of Inventory to inventory_deleted without having to specify all the 180 fields name to be moved :-) yep lazy
I already copied the table without the data all i need is some sort of query to move invetory_deleted before I delete it from inventory
I'v tryed adding a active/deleted field to the table, but this is a huge site and it causes to many problems everywhere else when showing data, stats ...etc
here is the delete code :-)
<cfquery datasource="#clientds#">
DELETE FROM inventory
WHERE inv_number=#form.inv_num#
</cfquery>
and this is what i tested so far
<cfquery datasource="#clientds">
insert into inventory_deleted (*)
select *
from inventory
WHERE inv_number=#form.inv_num#
</cfquery>
Help would be really apreciatedNot i get what you mean by nothing but this is what i did
<cfquery datasource="autoavantage" name="insertdata">
insert into inventory_deleted (*) select * from inventory where inv_num = #inv_num#
</cfquery>
and this is the error i got
Error Executing Database Query.
[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
Maybe you are looking for
-
SBO Mailer in a cluster environment
Hi, I am currently facing an issue where when I install SBO Mailer on a cluster environment, the installation removes applications and license manager for some reason gets uninstalled.. When I want to uninstall the SBO Mailer, I do not see it under t
-
Xcelsius 2008 on top of SAP BPC
Hi Experts, I am trying to use Xcelsius 2008 on top of SAP BPC. I want following functionality in my dashboard: 1. There is a drop down in the dashboard for Year-Month selection. 2. Based on that selection, the BPC query to be refreshed for the selec
-
Hi, I have just downloaded Camino to run alongside Safari, and when I have come to repair permissions on the Macintosh HD, I notice that I don't get the comprehensive list of permission repairs anymore. Back with 10.4.5, a whole list of permission ve
-
Just downloaded Photoshop Elements 11, still have Elements9 and Premier Elements 9 in my programs. Is it OK to uninstall them?
-
I am looking for a method to compare / synchronize repositories in order to be sure that repositories in different stages (test, acceptance, production) are the same. Historically there have been too many changes. Mainly the difference between the Ac