Number of rows in buckets of a partitioned table
Hello.
How can i retrieve the number of rows in a bucket for a partitioned table ?
Column ENDPOINT_NUMBER is only in DBA_HISTOGRAMS but not in DBA_PART_HISTOGRAMS.
No, i wanted to know how many different values for a specific column in the buckets of the histograms i created for one partitioned table.
I had the answer by querying user_part_histograms.
Similar Messages
-
How to find accurate number of Rows, and size of all the tables of a Schema
HI,
How to find the accurate number of Rows, and size of all the tables of a Schema ????
Thanks.SELECT t.table_name AS "Table Name",
t.num_rows AS "Rows",
t.avg_row_len AS "Avg Row Len",
Trunc((t.blocks * p.value)/1024) AS "Size KB",
t.last_analyzed AS "Last Analyzed"
FROM dba_tables t,
v$parameter p
WHERE t.owner = Decode(Upper('&1'), 'ALL', t.owner, Upper('&1'))
AND p.name = 'db_block_size'
ORDER by 4 desc nulls last;
## Gather schema stats
begin
dbms_stats.gather_schema_stats(ownname=>'SYSLOG');
end;
## Gather a particular table stats of a schema
begin
DBMS_STATS.gather_table_stats(ownname=>'syslog',tabname=>'logs');
end;
http://www.oradev.com/create_statistics.jsp
Hope this will work.
Regards
Asif Kabir
-- Mark the answer as correct/helpful -
Counting number of rows that resides in a partition/subpartiton
Hi,
I need to get the number of rows from a subpartition named (G2EDC_LOG_200704_20070407 ) in edc_log_test . Here is the below query which I am going to use to get the count of records.
Also I need to know if I can combine this query with out using UNION ALL.
Thanks in advance.
Jay
SELECT count(el.batch_nbr)
FROM edc_log_test el,
edc_batch_test eb
WHERE el.batch_nbr = eb.batch_nbr
AND eb.status IN ('SUSPENDED' ,'BALANCED' )
AND (eb.user_status = 'CLOSED'
OR eb.user_status IS NULL)
AND TO_CHAR(capture_date,'YYYYMMDD') >= sysdate - 60
AND nvl(do_not_remit, 0) <> 0
UNION ALL
SELECT count(el.batch_nbr)
FROM edc_log_test el,
edc_batch_test eb
WHERE el.batch_nbr = eb.batch_nbr
AND eb.status IN ('SUSPENDED')
AND eb.user_status IN ('NEW', 'OPEN')
AND TO_CHAR(capture_date,'YYYYMMDD') >= sysdate - 365
AND nvl(do_not_remit, 0) <> 0SQL> select count(1) from test_table;
COUNT(1)
1000
SQL> select count(1) from test_table partition(sys_p21);
COUNT(1)
122
SQL> select count(1) from test_table partition(sys_p22);
COUNT(1)
244
SQL> select count(1) from test_table partition(sys_p23);
COUNT(1)
261
SQL> select count(1) from test_table partition(sys_p23) where test_id=994;
COUNT(1)
1
SQL> select count(1) from test_table partition(sys_p23) where test_id=993;
COUNT(1)
0
SQL> select count(1) from test_table partition(sys_p23) where test_id between 900 and 1000;
COUNT(1)
24
SQL> -
How to control the number of rows selected from a sybase database table?
Hi, JDBC guru,
I'm working on project using Sybase 11.9.x database.We need to process a record in a table,first select it from the table,then do some computing,finally write it to a dbf file, if the above steps succeed,remove the original row in the table.Quite evidently, all these operation should be put into one transaction. But how can I select just a number of rows from the sybase database table?
Any hints?
Thank you in advance.
Regards,
JusitneStatement stmt...
stmt.setMaxRows(20); -
Restrict number of rows to be displayed in a table
Hi Guys,
I want to display n rows in a table which is output from a query which gives x rows....x>n....is there any way to do this ??
I tried 'No of rows property ' in the table properties..but that just changes the structure of the output table i.e. only 5 rows will be available in the table structure but scroll down option comes if no of rows > 5.....
Regards
Anshul Bhat
SAP BI,VCHi,
it should work once you are restricting the capacity of the out put port then it should provide that much rows only otherwise its a Bug.
Alternativily you are tellin to disaply using sorting then add a Sort operator to the output port and the display ur output port in down order.
But first option should work just check it again.
On which SP u r working?
Regards,
Govindu -
Different number of rows when add/delete the same table
Hi,
i've a problem in a select statement.
My database is a 9.2.0.8.
select *
from tab1 t1,
tab2 t2,
tab2 t3
where t1.id_c1 = 1
AND t1.id_c2 = t2.id_c2
AND t1.id_c2 = t3.id_c2
AND t2.id_init = 3693
AND t3.id_init = 3892;
936 rows selected.if i change the query in:
select *
from tab1 t1,
tab2 t2
where t1.id_c1=1
AND t1.id_c2 = t2.id_c2
AND t2.id_init in ( 3693,3892);
61132 rows selected.Any ideas? what's wrong??
Tnx
Edited by: 842366 on 10-ago-2011 3.10
Edited by: 842366 on 10-ago-2011 3.10You can see the difference yourself with this sample test data.
SQL> with t_data1 as
select 1 as id_c1,2 as id_c2 from dual union all
select 2 ,2 from dual
t_data2 as
select 1 as id_c2, 3693 as id_init from dual union all
select 1, 3693 from dual union all
select 1, 3892t from dual union all
select 1, 3892 from dual union all
select 2, 3693 from dual union all
select 2, 3892 from dual union all
select 2, 3892 from dual
select *
from t_data1 t1,
t_data2 t2
where t1.id_c1=1
AND t1.id_c2 = t2.id_c2
AND t2.id_init in ( 3693,3892);
ID_C1 ID_C2 ID_C2 ID_INIT
1 2 2 3693
1 2 2 3892
1 2 2 3892
SQL> SQL>
SQL>
SQL>
SQL> with t_data1 as
select 1 as id_c1,2 as id_c2 from dual union all
select 2 ,2 from dual
t_data2 as
select 1 as id_c2, 3693 as id_init from dual union all
select 1, 3693 from dual union all
select 1, 3892t from dual union all
select 1, 3892 from dual union all
select 2, 3693 from dual union all
select 2, 3892 from dual union all
select 2, 3892 from dual
select *
from t_data1 t1,
t_data2 t2,
t_data2 t3
where t1.id_c1 = 1
AND t1.id_c2 = t2.id_c2
AND t1.id_c2 = t3.id_c2
AND t2.id_init = 3693
AND t3.id_init = 3892;
ID_C1 ID_C2 ID_C2 ID_INIT ID_C2 ID_INIT
1 2 2 3693 2 3892
1 2 2 3693 2 3892
SQL> We see that in both the queries, the no. of column returned are different. In first it is 4 and in 2nd it returns 6.
Now ask yourself, what is the use of this query, and how I am suppose to use the values returned and also what is the purpose for each value.
Once you have the answers for these questions, the requirement becomes more clearer, doubts vanish and more often you can do things yourself. -
Max number of rows to display in a pivot table
I have a pivot table with two row levels and I need to fix the max amount of rows to display at the second level to five. Can I do that on excel 2013?
Example
Row Levels
Machine A
Part 1 (to be displayed)
Part 2 (to be displayed)
Part 3 (to be displayed)
Part 4 (to be displayed)
Part 5 (to be displayed)
Part 6 (not displayed)
Machine B
Part 1 (to be displayed)
Part 2 (to be displayed)
Part 3 (to be displayed)
Part 4 (to be displayed)
Part 5 (to be displayed)
Part 6 (not displayed)
and so go on.Hello,
you can use a filter to display only the top 5 items of the second level, based on their value. To do that, right-click on a label in the second level, then select Filter > Top 10. Change the 10 to a 5 in the next dialog.
You can also create a label filter, but it only takes one filter condition.
Another way is to select the rows you don't want to be shown, then use right-click > Filter > Hide Selected Items
cheers, teylyn -
Smartforms table: how to fix the number of rows to be display in the table.
Hello.
I´m having problems with a smartform. I have defined a window with 7 cm high. Then I have define a table to print the content of a table.
I'm using the header, the main area, and the footer. It seems to be ok. But the main area is sizeble. I mean, that if in the table has 2 records, it dispaly the 2 records and inmediatly display the footer. It probably use only 3 cm of the 7 cm defined for the high of the window.
And I want that the footer of the table would be display at the end of the 7 cm of the window. Is that posible ?
Please, tomorrow we will have our kick off the module and this is the last issue we have.
Thanks in advance for your help.Better idea wud be to create a WINDOW, just Below you Main window (After table) ..
In Form Layout (Form Painter) you can fix this Window on any place , Pass the FOOTER text node over there .. So you will get a Static FOOTER diplay ..
That what you need ?? Let me know
Edited by: Lokesh Tarey on Jul 22, 2010 7:15 AM -
Hi,
I need to query in max db to find number of rows exist in each and every table. Is there any query we can use to find in a single shot?
Example:
S.NO Table Name Number of rows
1 A 3000
2 B 5000Hi,
it depends on the database version you are using. In the newer database versions 7.8 and 7.9 you can use the system table files to get the total number of records.
SELECT sum (entrycount) from files where type = 'TABLE'
This includes the MaxDb systemtables as well.
If you want to count the number of rows of one schema only use the following join command between tables and files:
SELECT sum(entrycount) from files f, tables t where f.type = 'TABLE'
AND tableid = fileid and SCHEMANAME = '<schema>'
e.g.
SELECT sum(entrycount) from files f, tables t where f.type = 'TABLE'
AND tableid = fileid and SCHEMANAME = 'SUPERU'
The system table files contains for each table the entrycount, which is exaclty the number of records.
Precondition: All file directory counters for all tables have been created sucessfully. This is the case if table Sysupdatecounterwanted is empty. The creation is implictely executed.
Regards, Christiane -
Count total number of rows present in the schema
Count total number of rows present in the schema including table, sequence, view
Desirable Output
table Sequence Views
1000 20 1000You mean You need to count the No of Tables, View and Sequence Present in the Schema ??
Hi Some thing like this,
SELECT a.view_cnt AS "View Count", b.tab_cnt AS "Table Count",
c.seq_cnt AS "Sequence Count"
FROM (SELECT COUNT (*) view_cnt
FROM USER_VIEWS) a,
(SELECT COUNT (*) tab_cnt
FROM USER_TABLES) b,
(SELECT COUNT (*) seq_cnt
FROM USER_SEQUENCES) cWhich give you,
View Count Table Count Sequence Count
153 878 32Thanks,
Shankar
Edited by: Shankar Viji on Aug 28, 2012 3:03 AM -
How to increase number of rows display in ESS
Hi All,
how to increase number of rows display in ESS applications especially in Time approval inbox from standard display of 5 rows to say like 20 rows? is there a quick way to do it?
Thanks all
MurtyKalpesh,
it is actually in web dynpro view, I have seen this setting and it doesnt give option for increasing default number of rows in web dynpro application. Table is dynamically constructed in web dynpro implementation and I have the hard time finding out., Any help is appreciated in these lines,
Thanks
Murty -
XMLIndex: finding indexed XPaths and the number of rows in the path table
Hi,
I am storing non-schema-based binary XMLs in an XMLType column in 11g (11.1.0.6.0) and would like to index the XMLs either partially or fully using XMLIndex. I'm expecting to have a large number (tens of millions) of XML documents and have some concerns about the size of the XMLIndex path table.
In short, I am worried that the path table might grow unmanageable large. In order to avoid this and to plan for table partitioning, I would like to create a report of all indexed XPaths in an XMLIndex and to find out how many times each path is actualized in the path table. I would do this for a representative XML sample.
I have been creating XMLIndexes with different exclude/include paths, gathering stats with DBMS_STATS (estimate_percent = 100) and selecting the number of rows in the path table through USER_TABLES.
If anyone knows a more straightforward way of doing this all advice is very much appreciated.
Best Regards,
Rasko LeinonenThanks Marco,
I managed to get out all indexed paths using the following SQL. It took a while to understand how the join the XDB.X$PT39CW6BJR8W4VVE0G0LLGA0OCR5 and XDB.X$QN39CW6BJR8W4VVE0G0LLGA0OCR5 tables together but got there in the end. This helps to clarify which XPaths are being currently indexed by the XMLIndex.
begin
for v_row in (select PATH from XDB.X$PT39CW6BJR8W4VVE0G0LLGA0OCR5)
loop
declare
v_i BINARY_INTEGER := 1;
v_id raw(8);
v_len BINARY_INTEGER := 2;
v_skip BINARY_INTEGER := 1;
begin
while v_i < utl_raw.length(v_row.path) and
v_i + v_len <= utl_raw.length(v_row.path)
loop
v_i := v_i + v_skip;
v_id := utl_raw.substr(v_row.path, v_i, v_len);
--dbms_output.put_line(v_id);
for v_row2 in (select LOCALNAME, flags from XDB.X$QN39CW6BJR8W4VVE0G0LLGA0OCR5
where ID = v_id )
loop
if rawtohex(v_row2.flags) = '01'
then
dbms_output.put('@');
end if;
dbms_output.put(v_row2.localname);
if v_i + v_len < utl_raw.length(v_row.path)
then
dbms_output.put('/');
end if;
end loop;
v_i := v_i + v_len;
end loop;
dbms_output.put_line('');
end;
end loop;
end;
Example output:
RUN
RUN/@accession
RUN/@alias
RUN/@instrument_model
RUN/@run_date
RUN/@run_center
RUN/@total_data_blocks
RUN/EXPERIMENT_REF
RUN/EXPERIMENT_REF/@accession
RUN/EXPERIMENT_REF/@refname
RUN/DATA_BLOCK
RUN/DATA_BLOCK/@name
RUN/DATA_BLOCK/@total_spots
RUN/DATA_BLOCK/@total_reads
RUN/DATA_BLOCK/@number_channels
RUN/DATA_BLOCK/@format_code
RUN/DATA_BLOCK/@sector
RUN/DATA_BLOCK/FILES
RUN/DATA_BLOCK/FILES/FILE
RUN/DATA_BLOCK/FILES/FILE/@filename
RUN/DATA_BLOCK/FILES/FILE/@filetype
RUN/RUN_ATTRIBUTES
RUN/RUN_ATTRIBUTES/RUN_ATTRIBUTE
RUN/RUN_ATTRIBUTES/RUN_ATTRIBUTE/TAG
RUN/RUN_ATTRIBUTES/RUN_ATTRIBUTE/VALUE -
How to Efficiently Sample a Fixed Number of Rows
Good afternoon. I need to select a specific number of random rows from a table, and while I believe my logic is right it's taking too long, 30 minutes for a routine data size. Hopefully someone here can show me a more efficient query. I've seen the SAMPLE function, but it just randomly selects rows on a one-by-one basis, without a guaranteed total count.
This is the idea:
INSERT INTO Tmp_Table (Value, Sequence) SELECT Value FROM Perm_Table, DBMS_RANDOM.VALUE;
SELECT Value FROM Tmp_Table WHERE ROWNUM <= 1234 ORDER BY Sequence;I'd need to put the ORDER BY in a subselect for ROWNUM to work correctly, but anyway that's just an illustration. My actual need is a little more complicated. I have many sets of data; each set has many rows; and for each set I need to return a specific (different) number of rows. Perhaps project A has three rows in this table, and I want to keep two of them; project B has two rows, and I want to keep one of them. So I need to identify, for each row, whether it's valid for that project. This is what my data looks like:
Project Person Sequence Position Keeper
A Bill 1234 1 Yes
A Fred 5678 3 No
A George 1927 2 Yes
B April 5784 2 No
B Janice 2691 1 YesI populate Sequence with random values, then calculate the position of each person within their project, and finally discard people who's Position is greater than Max_Targets for the Project. Fred and April have the highest random numbers, so they're cut. It's not the case that I'm just trimming one person from each project; the actual percentage kept will range from zero to 100.
Populating the list with random values is not time-consuming, but calculating Position is. This is my code:
UPDATE Tmp_Targets T1
SET Position =
SELECT
COUNT(*)
FROM
Perm_Targets PT1
INNER JOIN Perm_Targets PT2 ON PT1.Project = PT2.Project
INNER JOIN Tmp_Targets T2 ON PT2.Target = T2.Target
WHERE
T1.Target = PT1.Target
AND T2.Sequence <= T1.Sequence
);The Target fields are PKs, and the Project and Sequence fields are indexed. Is there a better way to approach this? I could write a cursor that pulls out project codes and performs the above operations for each project in turn; that would be logically simpler and possibly faster. Has anyone here addressed a similar problem before? I'd appreciate any ideas.
This is on 9.2, in case it matters. Thank you,
JonathanYou've not given any indication of how max targets for a given project is determined, so for my example I'm using the ceiling of 1/2 of the number of records in each project which gives the same number of yes and no responses per project as you had:
with dta as (
select 'A' project, 'Bill' person from dual union all
select 'A', 'Fred' from dual union all
select 'A', 'George' from dual union all
select 'B', 'April' from dual union all
select 'B', 'Janice' from dual
), t1 as (
select project
, person
, row_number() over (partition by project order by dbms_random.value) ord
, count(*) over (partition by project) cnt
, rownum rn
from dta
select project
, person
, ord
, cnt
, case when ord <= ceil(cnt/2) then 'Yes' else 'No' end keep
from t1
order by rn
PROJECT PERSON ORD CNT KEEP
A Bill 2 3 Yes
A Fred 3 3 No
A George 1 3 Yes
B April 1 2 Yes
B Janice 2 2 No
5 rows selectedIn this example I use an analytic function to assign a random ordering for each record within a project in the middle query, in the final output query I am determining the yes no status based on the order within a project and the count of records in the project. If you had a table of projects indicating the thresh hold you could join to that and use the thresh hold in place of the ceil(cnt/2) portion of my inequality in the case statement. -
Oracle Error 01034 After attempting to delete a large number of rows
I sent the command to delete a large number of rows from a table in an oracle database (Oracle 10G / Solaris). The database files are located at /dbo partition. Before the command the disk space utilization was at 84% and now it is at 100%.
SQL Command I ran:
delete from oss_cell_main where time < '30 jul 2009'
If I try to connect to the database now I get the following error:
ORA-01034: ORACLE not available
df -h returns the following:
Filesystem size used avail capacity Mounted on
/dev/md/dsk/d6 4.9G 5.0M 4.9G 1% /db_arch
/dev/md/dsk/d7 20G 11G 8.1G 59% /db_dump
/dev/md/dsk/d8 42G 42G 0K 100% /dbo
I tried to get the space back by deleting all the data in the table oss_cell_main :
drop table oss_cell_main purge
But no change in df output.
I have tried solving it myself but could not find sufficient directed information. Even pointing me to the right documentation will be higly appreciated. I have already looking at the following:
du -h :
du -h8K ./lost+found
1008M ./system/69333
1008M ./system
10G ./rollback/69333
10G ./rollback
27G ./data/69333
27G ./data
1K ./inx/69333
2K ./inx
3.8G ./tmp/69333
3.8G ./tmp
150M ./redo/69333
150M ./redo
42G .
I think its the rollback folder that has increased in size immensely.
SQL> show parameter undo
NAME TYPE VALUE
undo_management string AUTO
undo_retention integer 10800
undo_tablespace string UNDOTBS1
select * from dba_tablespaces where tablespace_name = 'UNDOTBS1'
TABLESPACE_NAME BLOCK_SIZE INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS
MAX_EXTENTS PCT_INCREASE MIN_EXTLEN STATUS CONTENTS LOGGING FOR EXTENT_MAN
ALLOCATIO PLU SEGMEN DEF_TAB_ RETENTION BIG
UNDOTBS1 8192 65536 1
2147483645 65536 ONLINE UNDO LOGGING NO LOCAL
SYSTEM NO MANUAL DISABLED NOGUARANTEE NO
Note: I can reconnect to the database for short periods of time by restarting the database. After some restarts it does connect but for a few minutes only but not long enough to run exp.Check the alert log for errors.
Select file_name, bytes from dba_data_files order by bytes;
Try to shrink some datafiles to get space back. -
Difference in number of records in GROUP BY and PARTITION BY
Hi Experts
If I run the following query I got 997 records by using GROUP BY.
SELECT c.ins_no, b.pd_date,a.project_id,
a.tech_no
FROM mis.tranche_balance a,
FMSRPT.fund_reporting_period b,
ods.proj_info_lookup c,
ods.institution d
WHERE a.su_date = b.pd_date
AND a.project_id = c.project_id
AND c.ins_no = d.ins_no
AND d.sif_code LIKE 'P%'
AND d.sif_code <> 'P-DA'
AND a.date_stamp >='01-JAN-2011'
AND pd_date='31-MAR-2011'
GROUP BY c.ins_no,
b.pd_date,
a.project_id,
a.tech_no;
I want to show the extra columns a.date_stamp and a.su_date
in the out put so that I have used PARTITION BY in the second query but I got 1079 records.
SELECT c.ins_no, b.pd_date,a.date_stamp,a.su_date, a.project_id,
a.tech_no,
COUNT(*) OVER(PARTITION BY c.ins_no,
b.pd_date,
a.project_id,
a.tech_no)c
FROM mis.tranche_balance a,
FMSRPT.fund_reporting_period b,
ods.proj_info_lookup c,
ods.institution d
WHERE a.su_date = b.pd_date
AND a.project_id = c.project_id
AND c.ins_no = d.ins_no
AND d.sif_code LIKE 'P%'
AND d.sif_code <> 'P-DA'
AND a.date_stamp >='01-JAN-2011'
AND pd_date='31-MAR-2011'
Please help me why I got 1079 records.
And also please help me how to show the two extra columns in the out put whcich are not used in
GROUP BY clause.
Thanks in advance.Hi,
user9077483 wrote:
Hi Experts
If I run the following query I got 997 records by using GROUP BY. ...Let''s call this "Query 1", and the number of rows it returns "N1".
The results tell you that there are 997 distinct combinations of the GROUP BY columns (c.ins_no, b.pd_date, a.project_id, a.tech_no).
I want to show the extra columns a.date_stamp and a.su_date
in the out put so that I have used PARTITION BY in the second query but I got 1079 records. ...Let's call the query without the GROUP BY "Query 2", and the number of rows it returns "N2".
Please help me why I got 1079 records.Because there are 1079 rows that meet all the GROUP BY conditions. Query 2 has nothing to with distinct values in any columns. You would expect that N2 to be at least as high as N1, but it's not surprising that the N2 is higher than N1.
And also please help me how to show the two extra columns in the out put whcich are not used in
GROUP BY clause.Doesn't Query 2 show those two columns already? If the Query 2 is not producing the results you want, then what results do you want?
Post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
Explain, using specific examples, how you get those results from that data. Point out a couple of places where Query 2 is not doing what you want.
Always say which version of Oracle you're using.
Maybe you are looking for
-
Where/How do I copy the link to the online web form?
Hi there, I am a total beginner with FormsCentral. Here is my situation: I have registered for a trial which, in theory, grants 1 online form. I have imported a PDF template into FormsCentral's desktop tool. Then I have saved the new form. As a resu
-
IPhone 4s (7.0.2) hangs at 'Syncing Contacts' with iTunes 11.1
There seems to be a myriad of these various syncing issues posted; none of which have been answered and none that are exactly what I'm experiencing. My wife's 4s (iOS 7.0.2) has been hanging at syncing Contacts on iTunes 11.1 (iMac; Mountain Lion) th
-
how do i bring text to front of image using dream weaver?
-
My Macbook isn't allowing me to install the new OS X Yosemite even though I've backed up my computer, and it is compatible as it is a late 2008 model. And when I go in to the App Store, it is giving me this notification below. Please Help, what do I
-
Newly registered user doesn't have Data Model or Report Creation option
Hi, I have recently registered in http://bipdev2.us.oracle.com:7001/xmlpserver Except Create Report Job option, i do not have Create Data Model and Create Report options visible in my Home page. In My Account-> My Groups, in which i have BI Consumer