Dynamically partition a table based on different values of a specific column: possible?
I'll start by explaining my problem, so that you can have a global vision of the problem and perhaps suggest another solution. Problem: I have 2 tables with millions of records. Records are added daily, and so each row in each table has a column of "insertion_date".
C1 C2 ... C10 insertion_date (type date, ofc)
lines are cleaned according to the insertion_date parameter. This can happen in two ways:
1 - whenever an application error appears. In this case delete is based on a single day and would be like:
delete from T1 where insertion_date=##;
in other words remove us the lines added and then restart the program (business logic, can't change it)
2. every two weeks the data associated with these two weeks are deleted because will be most used:
delete from T1 where insertion_date between ## and ##; (a two weeks period here)
Delete is currently very slow: it takes abot 8 minutes just to remove approximately 5 M of records (with the same insertion_date), I can't even imagine the time required to delete records more.
So, here's my idea!
I would partition my DB according to the value of insertion_date.
To remove case 1 I would simply delete the partion associated with this insertion date, to remove scores of cases 2 associates at that interval.
For the needs of my application at most 15 were leaving are present each time (maybe 20 if I want to keep last at least 5 days of data), so the documented limit of 64000 partitions is not a problem.
Real problem is that I do not know insertion_date values in advance, so my question: is it possible to automatically create a new partition every time presents itself a new value of insertion_date?
And please correct me if I'm wrong, if I accomplish partitioning that I wouldn't need to edit above right queries? I know just the faster removal time am I correct?
No - it isn't bog standard range partitioning partitioning interval
But perhaps you're citing 9i documentation for a reason?
It is a feature of 11g... then only about 10 years.
create table t1 (col1 date) partition by range (col1) interval (numtodsinterval(1,'DAY')) (partition po values less than (to_date('01-01-2015','DD-MM-YYYY'))); table T1 created. select table_name, partition_name, high_value from user_tab_partitions where table_name = 'T1'; TABLE_NAME PARTITION_NAME HIGH_VALUE ------------------------------ ------------------------------ -------------------------------------------------------------------------------- T1 PO TO_DATE(' 2015-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA...' insert into t1 select trunc(sysdate,'MM')+rownum-1 from dual connect by rownum <= 10; select table_name, partition_name, high_value from user_tab_partitions where table_name = 'T1'; TABLE_NAME PARTITION_NAME HIGH_VALUE ------------------------------ ------------------------------ -------------------------------------------------------------------------------- T1 PO TO_DATE(' 2015-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA...' T1 SYS_P450383 TO_DATE(' 2015-07-02 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA...' T1 SYS_P450384 TO_DATE(' 2015-07-03 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA ...' T1 SYS_P450385 TO_DATE(' 2015-07-04 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA ...' T1 SYS_P450386 TO_DATE(' 2015-07-05 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA ...' T1 SYS_P450387 TO_DATE(' 2015-07-06 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA ...' T1 SYS_P450388 TO_DATE(' 2015-07-07 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA ...' T1 SYS_P450389 TO_DATE(' 2015-07-08 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA ...' T1 SYS_P450390 TO_DATE(' 2015-07-09 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA ...' T1 SYS_P450391 TO_DATE(' 2015-07-10 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA ...' T1 SYS_P450392 TO_DATE(' 2015-07-11 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA ...'
Tags: Database
Similar Questions
-
Web Forms: Deleting line based on the value of a specific column
Hello
I have an online form in which I want to apply delete missing on the ranks, but only on the value of the first column. So, if the first column is #missing I want the deleted row, even if the columns are given in it.
Is it possible to do this?
I'm on ver 11.1.2.2 Hyperion Planning
Shehzad
Published by: shehzad k on January 24, 2013 11:51Unfortunately, no. There is no way to add the delete line based SOLELY on the existence of a value in the first column. It would be nice to see some of the more advanced features "conditional delete", we en flies over to the planning of the entry forms.
You can do the "clumsy" things with data validations where you gray - out ranks in view of the existence of a value in a particular cell, however while this might SUGGEST that the user should not enter data in a particular line, it would not PREVENT to do so.
We have seen many improvements in form lately with the introduction of data validations. I hope the momentum continues.
-Jake
-
How to replace the value of a column in a table based on the value in the second column?
Hi, I would like to find in a table 2D for values that meet certain criteria (for example, a column< 0.98).="" based="" on="" which="" rows="" meet="" this="" criteria,="" i="" want="" to="" replace="" the="" values="" in="" a="" different="" column="" of="" the="" array="" (change="" to="" 'nan'="" so="" that="" the="" values="" will="" not="" be="" included="" in="" any="" calculations="" on="" that="" column,="" for="" example="" the="" finding="" the="" mean).="" i've="" attached="" a="" sample="" .csv="" file.="" if="" the="" values="" in="" column="" 3="" (index="" 2)="" are="" less="" than="" 0.980="" (or="" some="" other="" user="" defined="" value),="" then="" the="" value="" in="" column="" 2="" (index="" 1)="" should="" be="" replaced="" with="" nan.="" can="" someone="" help="" out="" with="" this="" search="" and="" replace="">
Thank you
Keith
(using LV 2009 SP1)
A few quick hits.
You can merge the two for loops
You have not need one of the constants 1 and 2 in the index table. They will solve automatically when you expand on the index picture, once you have wired to 0 in the column index.
It seems a lot of handling additional table spent unnecessarily.
See below. I did not try to duplicate your code to see how it actually works, but I believe that I have attached will give the same result with less steps.
-
Is there an easy way to filter a 2D table based on the values in two fields?
Y at - it an easy way to filter a 2D table based on the values of one of the fields. In my attached VI the output array has the following format:
Ident Frame Type bytes TimeStamp data
10:57:07.621 3AD00016 POUVEZ 8 0000000000000000 data frame
10:57:07.622 3AD00017 CAN data frame 8 000005E000000000
10:57:07.624 3AD00018 POUVEZ 8 0000000003300000 data frame
10:57:07.625 2DC00000 POUVEZ 8 0000000000000000 data frame
10:57:07.626 3AD00019 POUVEZ 4 0000030000000000 data frame
I would like to delete all lines that do not have an "Ident" between the values of 3AD00000 and 3AD0001E. So for the data above the fourth row would be removed. The only way I can see to do this is to form a 1 d table. Is there a better approach?
Thank you.
Hi chuck72352,
After you've sorted your data, you can use the function InRange. Combined with a "search in 1 table D", you get the range you really want.
Mike
-
dynamically display title based on the value selected in the column picker
Hi all
Would it be possible to display the title of the dynamic report based on the value selected in the column picker. Suppose I have two State of the column and region. When I choose the status in the column picker the title of the report will show 'Summary of the situation' when I'll choose the region then the title will change to "summary of the region. Please help me...Hello
Check your mail before I send the entire process with screenshots.
Concerning
NGO
-
Name of the dynamic property of object in the table based on the value of a variable
I have two paintings of custom class objects
var obj1:Object1 var obj2:Object2 var array1:Array = [obj1[0], obj1[1], ...] var array2:Array = [obj2[0], obj2[1], ...]
Object1 has a property named. Name while Object2 has a property named. Title.
Now I have a common function including cab accepts an array (array1 or array2) and the name of property the object ("Name" or "Title") as input and needs to access this name of the property of the objects in the array:
function myFunction(arr:Array, fieldName:String) { arr[0].fieldName = "xxx"; }
the problem I have this achievement does not because the code in the function assumes that the property of that object in the table is actually a string "fieldName" while I want to dynamically determine the names of the fields based on the value of this variable, but cannot understand the syntax to do!
Don't know if I'm clear - hope that makes sense... ;-) Thank you
Hey p3pp3r,
I think I understood you. Try the following and see if you get good results:
function myFunction(arr:Array, fieldName:String) { arr[0][fieldName] = "xxx"; }
Let me know how it turns out. Good luck!
-
How to highlight the line of the ADF table based on the value of the column?
Hi all
I use jdev 10.1.3.4. I want to highlight a table row or a cell based on the value of the column.
Lets say, I have a table emp with column empid, empname and sal. I want to emphasize the lines that have sal = 10000.
How can I achieve this? Please help me with this.
Thank you
AbhijitHello
You want to highlight the lines? or set a different color for the lines? If it's the second, you can set the inline style based on the salary. (+ Edit: well, never mind, both are same :)) +)
Something like
If you want the entire line to be a different color, you have 2 options.
1. define the same style inline for all columns in the table (good if you want to do only for a single table).
2. create a style class and apply the styleclass based on the value of sal (preferably if you want the same behavior in all of your application).Arun-
Published by: joel Ramamoorthy, October 23, 2009 16:56
-
Dynamic creation of tables based on Excel:
Dear Experts,
I have a requirement like this can you help me on this you can
I have some sheets with excel data. I want to create dynamic tables based on the spreadsheets excel and that excel spreadsheets this specific data should be imported into this table. How can I achieve this?
Is it possible to make this one
Please help me on this
983563 wrote:
Can you guies give any sample format so that I can try from here
Mukesh seems to talk about using Excel to connect to Oracle and Excel create tables and insert data, such as a client application.
However, this is not what you're asking.
The examples you need are in the links that Anton has provided, which describe in detail how to set up a heterogeneous service (or whatever now calls Oracle 11 g go - they have changed the name), and then you can query the Excel workbook as if each worksheet is a table, with the first line of each leaf with column names. You can even search the workbook to see what "tables" (sheets) exist and what "column names" (first row labels), use select standard... from queries of type user_tables@excel (once you have configured your heterogeneous service).
As Marty said well, what is the purpose to do this dynamically, as dynamically created tables will require code created dynamically for use.
An application design and database well-designed will dictate what data formats and tables are at design time.
-
Dynamic report query table based on selected LOV
Hello
Need some suggestions and Tips how to query dynamically table via lov to report.
Scenario:
Table, TABLE_LIST, a tablename (table in DB) and filter (for where clause) column. The TABLENAME_LOVE is derived from the table TABLE_LIST.
D SELECT TABLENAME TABLENAME TABLE_LIST R
On Page 2, a select list item, page P2_TABLENAME use TABLENAME_LOV
All data tables in the table_list has an identical structure (columns, triggers, primary key and so on).
I want to have the query area of the report of the table based on selected LOV.
Example,
TableName Filter
WBR
CD2 ACTIVE = 'Y '.
When select TB1, regin report ask TB1 on the base.
When select CD2, will interview the report based on CD2 regin WHERE ACTIVE = 'Y '.
Question:
How can I query function & P2_TABLENAME. WHERE & P2_FILTER.
As
Select col1, col2 from P2_TABLENAME WHERE & P2FILTER
Appreciate any suggestions and tips.
TigerwapaHello
You should always put your version of the Apex, version of DB and such other information as suggested in the FAQ.
And now wherever you are referring to report, you need to answer if it's IR or classic.Regarding your query, have you explored the kind of statement "SQL Query (body of function from PL/SQL returning SQL query)"?
This could be a good target for what you're trying to reach.Kind regards
-
Selection of a column in a table based on a value
Hello
I'm stuck with a little problem here. I need to fill a column based on a value. I have an xml that looks like this to make it simple. (Don't worry, I'm not managing the status of a stock of candy ;-)))
I have to build in rtf.
<? XML version = "1.0" encoding = "UTF-8"? >
-< ROWSET >
-< ROW >
< CANDY > Bubble gum < / CANDY >
without SUGAR < > < / SUGAR >
< / ROW >
-< ROW >
< CANDY > candy cinnamon < / CANDY >
without SUGAR < > < / SUGAR >
< / ROW >
-< ROW >
< CANDY > candy Gummy < / CANDY >
< SUGAR > < / SUGAR >
< / ROW >
< / LINES >
I have a table with two columns. I need to put on the left column candy SUGAR-free"and right the"tart ".
Is there a condition to get there. Or what I have to do two table a column next to each other and adapt if condition in the for each.
Best regards
OlivierHave the same structure of table with two columns and each conditions in each of your columns.
Say in column1: text to be printed
Column2: text to be printedHope this is what you want
-
Hello
I would like to insert a subarray (line) in a 2D to the correct index table. The position is to say the index value depends on the value of the first column of the table 2d.
As an examlple my 2d array would look like this
230 50 215 255
300 60 270 330
360 20 350 370
And I would like to insert another line (subarray) with the following values
320 40 300 340
This new line should be placed between the second and third rows (this is based on the first column only).
I tried the threshold 1 d function table by taking an 1Dsub array of my 2d array (first column), then using the first of the new line (320) as the threshold. It sort of work, but it does not work when I start the table (IE there is only 1 row) and it seems to not work properly on other occasions (as explained in the help of Labview).
Hopefully the explanation is clear enough for any suggestion. Thanks in advance for the help!
JTRI wrote:
The idea is I have start with a new table and add these lines in the right order every time that the user sets the values Jack
Ahh, so try this.
This will also work with an empty array.
You want to do with this function it is a Subvi.
Make the entries 'table' and 'subarray"on the connector, then 'new array' output.
You can then put this Subvi in a loop with a registry to shift and it will help to add new lines in a sorted order, when they are added.
That is what you were aiming for?
-
Insert the new value of a specific column
I have a table:
Add a column 'NUMBER ':CREATE TABLE SEG( COD VARCHAR2(4) EJER NUMBER(4,0) EXPE NUMBER(7,0) NIF VARCHAR2(9) DFECHA DATE);
This value for this new column is a column "new_valor" from the following selection:ALTER TABLE SEG ADD NUM NUMBER(15) NULL;
But... How to put this value in UPDATE?SELECT COD, EJER, EXPE, NIF, row_number() over (partition by COD,EJER,EXPE,NIF order by 1,2,3,4) AS new_valor FROM SEG;
Or another way...UPDATE SEG SET NUM= ???????? WHERE (COD,EJER,EXPE,NIF) = (SELECT COD, EJER, EXPE, NIF, row_number() over (partition by COD,EJER,EXPE,NIF order by 1,2,3,4) AS new_valor FROM SEG);
Published by: jortri on ene / 09/2009 11:47Check out this link.
http://download.Oracle.com/docs/CD/B19306_01/server.102/b14200/statements_9016.htm#SQLRF01606
Also check this
http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:6407993912330
http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:5318183934935
Concerning
REDA
-
Selectively hiding a row in a Table based on the value of the column
I have a data control that is populated from pro-grammatically, based on the user's selection in the page one of wanting to hide some lines on page 2 at the same time, I don't want to delete the value binding, is there to hide the lines instead of column?To the table of the ADF, to hide the lines according to the requirement, use the visible property on each of the columns.
For example, if you do not want to display all the lines that have IDs Director like 200 or 201.
Thank you
Nini -
How update the column in the table based on the value selected in apex4.1
Hi all
I have the following tables,
and it has the values as follows,leave_type table,it has the following fields, 1.emp_name, 2.sick 3.casual
leave_master table and it includes the following fieldsemp_name sick casual guru 10 10 mishra 10 10
I have the form based on the table "leave_master"1.emp_name, 2.leave_type 3.no_of_days
Here, the leave_type has the LOV which includes.
sick and casual.
When the form is filled out and clicked on the button submit,
I need to update the column leave_type in table leave_type,
for example,.
then I want to update the leave_type column,if emp_name:guru leave_type:sick no_of_days:3
sick sick = - no_of_days for the 'guru' of name
That is to say, ill = 10-3 = 7
then the leave_type of the table must be,
someone can such me what code or method I can use?emp_name sick casual guru 7 10 mishra 10 10
Thank you.
Published by: Gurujothi on May 24, 2012 21:54
Published by: Gurujothi on May 24, 2012 21:54Try something like this...
BEGIN
IF: PXX_LEAVE_TYPE = "Sick" THEN
UPDATE LEAVE_TYPE
THE PATIENT VALUE = SICK -: PXX_NO_OF_DAYS
WHERE EMP_NAME =: PXX_EMP_NAME;
ON THE OTHER
UPDATE LEAVE_TYPE
DEFINE CASUAL = CASUAL -: PXX_NO_OF_DAYS
WHERE EMP_NAME =: PXX_EMP_NAME;
END IF;
COMMIT;
END; -
Select all radio buttons in a table based on the value of selectOneChoice
Hi all
I have a selectOneChoice with two values
positive i.
II. negative
created vo and am
I have an adfTable with selectOneRadio added as a transitional attribute.
The table is created on the vo.
what I have to do is, when the user select positive of selectOneChoice all the positive radiobutton in the adfTable must be selected and the same for negative also.
I can get the value of the selectOneChoice in the bean using valueChangeEvent.
But I need assistance in the selection of all positive values in adfTable using the selectOneChoice value.
Reference would be useful.
Thank you very much
Kind regards
Jean-Felix
Hi all
Let me post the answer, hope this helps someone.
selectOneChoice
Positive P
N negative
on selectOneChoice event ValueChangeListener
to loop through the rows of the adfTable
If valueChangeEvent.getNewValue () is equal to 'p '.
Assign PositiveRadiobtn attribute 'p '.
otherwise set it to "n".
Kind regards
Jean-Felix
Maybe you are looking for
-
X 360-15 t Touch portable spectrum: imaging system, USB Flash drive recovery?
I'll create my recovery Image of the system using a USB Flash drive, how many GBs do I need?
-
Portege Z30-A-1CN - non-adjustable screen brightness
HelloI have the following problem:I can't change the brightness of the screen. Or by the 'FN' keys, or through "windows Mobility Center.I had no idea why. It seems that the screen works on its maximum intensity.Any suggestions? I am using windows 7 6
-
setting language on photosmart 6510
my children were able to change the language affecting English as a foreign language how do I change it in English?
-
I've worked hard for three hours in the middle of the night, made extremely dfficult work on several Word documents and Excel spreadsheets. at the same time - the kind of work that you can do if you're sure not not to be interrupted. All of a sudden
-
Reinstall the passing game Luxor 5th to my computer
I bought pass Luxor 5th on msn games. I can't find it on my computor. summer trying myself to find it, but don't know where to go.