Hi Folks.
As usual, as have an unusual problem.
I have an enormous table, over 308 million rows. I need to perform aome operation on that table but all at once won't work here; long transaction. So I wanted to see if I could break it down by rowid's. Yes, I know a rowid (in a regular table) is a composite of (Page address, slot number) but it could still be treated as an integer for my purposes. seen as an integer, the highest rowid in the table is 2,147,483,412 (Hex: 7FFF FF14). So I came up with this unioned query to see how many rows there are in each of several classes. Here's the query (with actual table name disguised):
select "Under 500 Million", count(*) from mytable where rowid > 0 and rowid <= 500,000,000
union
select "(500 mil - 1 billion)", count(*) from mytable where rowid > 500,000,000 and rowid <= 1,000,000,000
union
select "(1 billion - 1.5 billion)", count(*) from mytable where rowid > 1,000,000,000 and rowid <= 1,500,000,000
union
select "(1.5 billion - 2 billion)", count(*) from mytable where rowid > 1,500,000,000 and rowid <= 2,000,000,000
union
select "(Over 2 billion)", count(*) from mytable where rowid > 2,000,000,000
union
select "(Gone negative)", count(*) from mytable where rowid <= 0
;
I have inserted commas here to show that I have not make a funny mistake in specifying the big numbers. Here are the counts:
(constant) (count(*))
(1 billion - 1.5 billion) 39052800
(1.5 billion - 2 billion) 39052820
(500 mil - 1 billion) 39052820
(Gone negative) 0
(Over 2 billion) 11519300
Under 500 Million 39052800
Waitaminit! These add up to about 167 million & change. How is this possible, when we know the count is over 308 milion? I think (!!!) I have all possible rowid integer values covered. That aside, I think it reasonable that ever class has the same number of rows, except the last one, which has no filled up yet.
What am I missing? (Yeah, I know about the screws. 🤓)
Advice, anyone?
Thanks one and all for a course correction.
------------------------------
+-----------------------------------------------------------+
| I am pleased to report that I had no problems today. |
| I had only issues, opportunities, challenges and valuable |
| learning experiences. |
+------------------------------------------ Jacob S --------+
------------------------------