Performance of update query for single column vs multiple column
Hi All,
I could not find any answer for this, does it ever matter in terms of performance updating single column versus multiple column in a single update query.
For eg. table consisting of 15 columns, what would be the difference in performance when one column is update in the single query against another update query where 15 columns are updated.
Please do keep in mind my table columns in actually could be around 150+.
Thanks for any information provided.
If updated columns aren´t on where clause , then the only impact of 15 columns will be a increase on redo generation, and a possible chainning row.
So since the redo is one of the things that have a large impact, the answer is yes.
The performance will be slower.
Regards
Helio Dias.
http://heliodias.com
OCE SQL, OCP 9i
Similar Messages
-
Hello , Recently my company purchased a Fujifilm X30 . We were surprised that Adobe has not updated the plug in for this camera. Since we are your customers, we would like to know, when they will perform this update ? For us it is very important to work with all our tools work quickly and efficiently, I guess I understand.
We await your response .
Thank you very much .This is a user to user forum with "some" Adobe staff participation, make requests at this link
https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform -
Merge multiple rows into single row (but multiple columns)
How to merge multiple rows into single row (but multiple columns) efficiently.
For example
IDVal IDDesc IdNum Id_Information_Type Attribute_1 Attribute_2 Attribute_3 Attribute_4 Attribute_5
23 asdc 1 Location USA NM ABQ Four Seasons 87106
23 asdc 1 Stats 2300 91.7 8.2 85432
23 asdc 1 Audit 1996 June 17 1200
65 affc 2 Location USA TX AUS Hilton 92305
65 affc 2 Stats 5510 42.7 46 9999
65 affc 2 Audit 1996 July 172 1100
where different attributes mean different thing for each Information_type.
For example for Information_Type=Location
Attribute_1 means Country
Attribute_2 means State and so on.
For example for Information_Type=Stats
Attribute_1 means Population
Attribute_2 means American Ethnicity percentage and so on.
I want to create a view that shows like below:
IDVal IDDesc IDNum Country State City Hotel ZipCode Population American% Other% Area Audit Year AuditMonth Audit Type AuditTime
23 asdc 1 USA NM ABQ FourSeasons 87106 2300 91.7 46 85432 1996 June 17 1200
65 affc 2 USA TX AUS Hilton 92305 5510 42.7 46 9999 1996 July 172 1100
ThanksHi,
That's called Pivoting . The forum FAQ has a section on this subject: {message:id=9360005}
I hope this answers your question.
If not, post your best attempt, along with a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and also post the results you want from that data. (You did post the results you wanted, but they're very hard to read because they're not formatted. Use \ tags, as described in the forum FAQ, below.)
Explain, using specific examples, how you get the results you want from the data given.
Always say which version of Oracle you're using (e.g., 11.2.0.2.0). This is always important, but especially so with pivots.
See the forum FAQ {message:id=9360002} -
How can I separate one column into multiple column?
How can I separate one column into multiple column?
This is what I have:
BUYER_ID ATTRIBUTE_NAME ATTRIBUTE_VALUE
0001 PHONE_NUMBER 555-555-0001
0001 EMAIL [email protected]
0001 CURRENCY USD
0002 PHONE_NUMBER 555-555-0002
0002 EMAIL [email protected]
0002 CURRENCY USD
0003 PHONE_NUMBER 555-555-0003
0003 EMAIL [email protected]
0003 CURRENCY CAD
This is what I would like to have:
BUYER_ID PHONE_NUMBER EMAIL CURRENCY
0001 555-555-0001 [email protected] USD
0002 555-555-0002 [email protected] USD
0003 555-555-0003 [email protected] CAD
Any help would be greatly appreciated.This is another solution. Suppose your actual table's name is test(which has the redundant data). create a table like this:
CREATE TABLE test2 (BUYER_ID number(10),PHONE_NUMBER varchar2(50),EMAIL varchar2(50),CURRENCY varchar2(50));
then you will type this procedure:
declare
phone_number_v varchar2(50);
EMAIL_v varchar2(50);
CURRENCY_v varchar2(50);
cursor my_test is select * from test;
begin
for my_test_curs in my_test loop
select ATTRIBUTE_VALUE INTO phone_number_v from test
where person_id=my_test_curs.person_id
and attribute_name ='PHONE_NUMBER';
select ATTRIBUTE_VALUE INTO EMAIL_v from test
where person_id=my_test_curs.person_id
and attribute_name ='EMAIL';
select ATTRIBUTE_VALUE INTO CURRENCY_v from test
where person_id=my_test_curs.person_id
and attribute_name ='CURRENCY';
INSERT INTO test2
VALUES (my_test_curs.person_id,phone_number_v,EMAIL_v,CURRENCY_v);
END LOOP;
END;
Then you will create your final table like this:
create table final_table as select * from test2 where 1=2;
After that write this code:
INSERT ALL
into final_table
SELECT DISTINCT(BUYER_ID),PHONE_NUMBER,EMAIL,CURRENCY
FROM TEST2;
If you have a huge amount of data in your original table this solution may take a long time to do what you need. -
Single Update query for multiple tables
Hiii ....
I want to update Table A and Table B in a single update query can it be possible.
it is something like i have previously done with Mysql.
e.g ..
UPDATE A, B set a.A=1, b.B=X where (id.A= id.B) and id=101.
Is it possible or how can i do it, help me out.sorry, i am posting the mysql example agin, it is something like this
e.g ..
UPDATE A, B set A.a=1, B.b=X where (A.id= B.id) and A.id=101 -
Lock record on query for single user
Is there any way to use the on-lock trigger to lock a particular record as it is simply queried, instead of after a change has been made to it. For instance, if user A is viewing a queried record, and user b attempts to query the same record, then we would display a message to user b stating that the record is unavailable, or simply just skip it. I know that if a field in the current record is altered, forms recognizes the status of the record as 'CHANGED' and will then by default proceed to lock the record until a commit or rollback is issued. However, this is not what we are looking for. I have read a little about this, and I have seen an example through a datablock based upon a stored procedure, a ref cursor select for update statement. (NOTE: we are not basing our datablock on a stored procedure though)
We have two scenarios that require this type of locking capability. The first simply queries one distinct record, and the second queries a distinct result of records.
A select for update statement would suffice for the first scenario, i.e. if another user tries to query the same record, their query is denied; however, for the second scenario when two users perform the same query, user a is viewing record #1, and user b's program sees that record #1 is 'locked' and thus proceeds to the next record in the result .
Any suggestions? Thanks in advance.
Eric M WeissYou don't need to override on-lock you can just call the LOCK_RECORD built-in in POST-QUERY or whatever.
-
How to disable Query for single controls in a Form Applet?
Hi All,
this should be so simple, but seems like I don't get it at the moment.
I have a Form Applet in HI Mode and want to disable the possibility to Query on certain fields. these are Calculated fields and querying will most likely crash the application due to heavy performance impact. They should be for displaying only. How to do that? I have searched for Applet Control User Properties and such stuff but couldn't find one.
ThxHi Siebelade thanks for your reply,
in the meantime I managed to do it using a BusComp Field User Property called "DisableSearch". If you set this to "TRUE" for the desired fields, the user will receive an error message when trying to query for these fields.
Benny -
Performance of the query for YTD info
Hi Experts,
I have a query it takes more time when you run that query for period or year. Like selection ceritaria is few days info work quick. But when it run for period it take more then 10 minutes.
Give me suggestions how to speed up the query
ThanksBuild aggregates. Goto RSRT, execute and debug, switch on statistics and display aggregates checkbox. See whether an aggregate is hit or why not and build aggregates accordingly.
Also look at statsitcs if database is performance killer see events 9000ff for this.
Other hints: reduce start level of your query and remove some chracteristics if possible.
Regards,
Juergen -
Update query for 2 lakhs records
I have 2 tables with 3 common columns (Col1, col2,Primary). One common column name is primary (oracle key word). No indexes are used on these tables. I need to write an update query as shown below.
Emp table
Col1 col2 primay
100 101 y
103 104 n
201 105 y
100 101 y
Dept table
Col1 col2 primay
100 101 null
103 104 null
000 656 null
Update query Result
Col1 col2 primary
100 101 y
103 104 n
Please help me.
ThanksUpdate dept d
set d.primay = (select distinct e.primay from emp e where e.col1 = d.col1 and e.col2 = d.col2);
In emp table there are 100 and 101 with two entries but with same primay value. so to handle such scenarios I have taken distinct iniside select statement.
if you have a case like where in emp table col1 and col2 are same and having different primay table, then obviously you should tell which value should go and update the dept table and based on what logic. -
How to query for extended ASCII characters in column value
Hi All
Sorry if this has been answered before. I tried searching but none of them seems to work for me.
I am trying to search for inverted ? in my column.
I am using the following query
select *
from table_name
where regexp_like (description , '¿' )Did you try:
like '%¿%'
create table table_name (description varchar2(100))
insert into table_name values ('jh¿¿gagd')
insert into table_name values ('jhga345gd')
insert into table_name values ('j1231232hgagd¿')
select *
from table_name
where regexp_like (description , '¿' )
DESCRIPTION
jh¿¿gagd
j1231232hgagd¿
select * from table_name
where description like '%¿%'
DESCRIPTION
jh¿¿gagd
j1231232hgagd¿Edited by: user130038 on Sep 8, 2011 12:29 PM -
Hi All,
I'm using Lumia 925, recently got an update option for my phone and I updated it.
Its now showing lumia black.
But even after the update I'm not able to get the option for call+sms setting (for call block feature)
Can someone help me with this??
Thanks
Aman MehraHi mehraaman,
Kindly Update all System Apps on your phone. Follow the instruction here: WP8 System Apps. -
Hi
Can any body send valid update query like this:
<sql:update var="XX">
Update emp set name='yy', phone='1234' where id='abc'
</sql:update>
Thanks in Advance
SPHi
Can any body send valid update query like this:
<sql:update var="XX">
Update emp set name='yy', phone='1234' where id='abc'
</sql:update>
Thanks in Advance
SP -
Split the result of one column to multiple columns
Hi Experts,
Could you please help me to split the result of below query into multiple columns:
EXEC master..xp_cmdshell 'wmic service where "Caption Like ''%sql%''" get Caption , StartName, state'
I needs result of this query something like below but in tabular format:
Caption
StartName
State
SQL Server Integration Services 11.0
NT Service\MsDtsServer110
Running
SQL Full-text Filter Daemon Launcher (MSSQLSERVER)
NT Service\MSSQLFDLauncher
Running
SQL Server (MSSQLSERVER)
NT Service\MSSQLSERVER
Running
SQL Server Analysis Services (MSSQLSERVER)
NT Service\MSSQLServerOLAPService
Running
--------------------------------- Devender BijaniaRefer below query,
DROP TABLE #TEMP
CREATE TABLE #TEMP(COLS NVARCHAR(300))
INSERT INTO #TEMP
EXEC master..xp_cmdshell 'wmic service where "Caption Like ''%sql%''" get Caption , StartName, state'
SELECT *,
PATINDEX('% %',COLS) C1,
LEFT(COLS, PATINDEX('% %',COLS)) Caption,
LTRIM(RIGHT(COLS,LEN(COLS)-PATINDEX('% %',COLS))) ServiceName,
PATINDEX('% %',LTRIM(RIGHT(COLS,LEN(COLS)-PATINDEX('% %',COLS)))) C2,
LTRIM(RIGHT(LTRIM(RIGHT(COLS,LEN(COLS)-PATINDEX('% %',COLS))), LEN(LTRIM(RIGHT(COLS,LEN(COLS)-PATINDEX('% %',COLS)))) - PATINDEX('% %',LTRIM(RIGHT(COLS,LEN(COLS)-PATINDEX('% %',COLS)))))) State
FROM #TEMP
WHERE COLS IS NOT NULL AND RTRIM(LEFT(COLS, PATINDEX('% %',COLS))) <> 'Caption'
Regards, RSingh -
Update query for XMLTYPE column
Hello everyone,
I have inserted xml data into XMLTYPE column of my table,xml data is something like this
<Data type="FYI">
<ID xmlns="http://orcl.com">T-1-1</ID>
<Category>FRAME</Category>
<ProductID>1</ProductID>
<Name xmlns="http://orcl.com">Frame </Name>
<Type>BASIC</Type>
<Code>INSTALL</Code>
<NodeID>1</NodeID>
</Data>
Now i need to update the values inside the <Data> element,like
ID == T-2-2
Category == IFRAME
ProductID == 1.1
Name == IFRAME
We are using oracle 10g R2.
Please help me out how to update. It would be very thankfull for your valuble suggestions
Thanks in advance<Services>
<DataService type="FRLY">
<ID xmlns="http://www.openapplications.org/oagis/9">T-1-1-FRLY</ID>
<CategoryCode>FRAME</CategoryCode>
<ProductOfferingID>1</ProductOfferingID>
<Name xmlns="http://www.openapplications.org/oagis/9">Frame Relay</Name>
<SubType>FRLY - BASIC</SubType>
<ActionCode>INSTALL</ActionCode>
<NodeID>1</NodeID>
<Contract>
<ID xmlns="http://www.openapplications.org/oagis/9" schemeName="Networx Universal">00000</ID>
<Category name="Contract Type">U</Category>
</Contract>
<Contract>
<Type xmlns="http://www.openapplications.org/oagis/9">Routine</Type>
</Contract>
<CustomerParty>
<Location/>
</CustomerParty>
<ProvisioningStatus type="BillingSetup">
<Description xmlns="http://www.openapplications.org/oagis/9">C</Description>
</ProvisioningStatus>
<MileStone>
<ID xmlns="http://www.openapplications.org/oagis/9">CWD</ID>
<Date>2007-01-29</Date>
</MileStone>
<ActivityStatus>
<Code xmlns="http://www.openapplications.org/oagis/9" name="DueDate"/>
<EffectiveDateTime xmlns="http://www.openapplications.org/oagis/9">2007-01-29T00:00:00Z</EffectiveDateTime>
</ActivityStatus>
<AssociatedIDs>
<ID xmlns="http://www.openapplications.org/oagis/9">1</ID>
</AssociatedIDs>
<AssociatedIDs>
<TemporaryID schemeName="OPKEY">34908</TemporaryID>
</AssociatedIDs>
<Location>
<ID xmlns="http://www.openapplications.org/oagis/9">T-510092</ID>
</Location>
<OrderID>RequestID</OrderID>
<Accessory>
<ActionCode>ADD</ActionCode>
<Description xmlns="http://www.openapplications.org/oagis/9">IBM ESERVER-XSERIES306</Description>
<CategoryCode>5</CategoryCode>
<InstallVendorParty>
<Name xmlns="http://www.openapplications.org/oagis/9">MCI</Name>
</InstallVendorParty>
</Accessory>
<Circuit>
<ID xmlns="http://www.openapplications.org/oagis/9">T-1-1-FRLY</ID>
<AssociatedIDs/>
</Circuit>
</DataService>
</Services>
This was my xml which i have inserted into DB for the column XMLTYPE.Now i need to update few values in this whole file like values of
ID under<DataService>
Name under <DataService>
ID under <Contract>
Description under <ProvisioningStatus>
i was using the UPDATEXML query to update those it's saying i row updated but when i extract it says null.
Please help me out to solve this problem.
Thanks in advance. -
Single query for displaying all but 1 column values for all tables
Hi,
All the tables have SYS_CREATION_DATE column.
But I dont want to display this column value
Can someone suggest some way in which i could achive this?
Oracle version:11gR1
OS:SunOS
Cheers,
Kunwar
Edited by: user9131570 on Jul 6, 2010 7:57 PMuser9131570 wrote:
@Tubby
I *want to display table-wise the values of all but 1(SYS_CREATION_DATE) columns in my database.*
I need this in order to compare it to another database for all these values .Let me make a wild guess at what you are getting at.
Given these two tables
create table emp
(empid number,
empname varchar2(15),
empaddr varchar2(15),
sys_creation_date date);
create table dept
(deptid number,
deptmgr varchar2(10),
sys_creation_date date);you want to somehow combine
select empid,
empname,
empaddr
from emp;with
select deptid,
deptmgr
from dept;into a single sql statement?
Maybe you are looking for
-
Exporting text only from specific paragraph style
Hi, Is there a way to export text from Indesign to txt or preferably Excel from specific paragraph style ? I am trying to export only item numbers and prices to excel spread sheet so I can compare against original excel spreadsheet. Thank you !
-
When I set the dimensions of two images to identical widths and heights, they do not appear as the same size when viewed at the same zoom level in Photoshop. Also, they aren't the same size when opened with other programs. Why this inconsistency?
-
I experience strange vertical lines over the text
I experience strange vertical lines over the text. i belive it started when i updated my firefox to it's latest version i tried synchronizing me clear view, but it didn't help
-
Trouble looking up ejb (sun app server 8.1)
Hi, I am using the below code to lookup a stateless session ejb Hashtable env = new Hashtable(); env.put("java.naming.factory.initial", "com.sun.jndi.cosnaming.CNCtxFactory"); env.put("java.naming.provider.url", "iiop://127.0.0.1:3700"); javax.naming
-
Is it as simple as saving the newsletter in different formats? What are the steps I need to take so that the newsletter can be printed, emailed and used on a website? Thanks