Database Table Partition in oracle DB 11g - oracle11g

I have a table of size 20GB.I need to perform partition in that existing table,please give your valuable tips and suggestions.
Any help will be appreciated.

Please describe your question. Partition is totally depends up on size of table and parameters in it.

We can create PARTITION in oracle DB by particular column.
CREATE TABLE Employee
(
EMP_ID NUMBER,
JOINING_YEAR NUMBER
)
PARTITION BY LIST (JOINING_YEAR) (
PARTITION EMP_2017 VALUES (2017),
PARTITION EMP_2018 VALUES (2018),
PARTITION EMP_2019 VALUES (2019),
PARTITION EMP_2020 VALUES (2020),
PARTITION EMP_2021 VALUES (2021),
PARTITION EMP_2022 VALUES (2022),
PARTITION EMP_2023 VALUES (2023),
PARTITION EMP_2024 VALUES (2024),
PARTITION EMP_2025 VALUES (2025),
PARTITION EMP_2026 VALUES (2026),
PARTITION EMP_2027 VALUES (2027),
PARTITION EMP_2028 VALUES (2028),
PARTITION EMP_2029 VALUES (DEFAULT)
)

Related

Query composite index query in Dynamo

I have a DynamoDB table with following keys:
id: partition key
created_at: sort key
brand#category#size#color: partition key for global index 'byAttributes'
The global index partition key is a composite of 4 table attributes using '#' as a delimiter.
Is there a way in DynamoDB that I can query the table using only a subset of the attributes using a wildcard for unspecified attributes?
As examples:
byAttributes = 'levis#shirts#*#red'
byAttributes = '*#pants#L#*'
I don't wish to use a FilterExpression because it only filters data after a search. I want to take advantage of the attributes being indexed.
No. But you can create alternative GSIs for different combinations.
You can also include a hierarchical SK value and use begins-with to limit based on zero or more values.
Putting some values in the PK and the rest in a hierarchical SK achieves a lot of combinations.
For example have a GSI:
PK = category,
SK = size#brand#color
Now you can query by category, category/size, category/size/brand, or all four.
If it gets more than four you may want to look at Rockset as an indexing system against DynamoDB data.

dynamodb query to select all items that match a set of values

In a dynamo table I would like to query by selecting all items where an attributes value matches one of a set of values. For example my table has a current_status attribute so I would like all items that either have a 'NEW' or 'ASSIGNED' value.
If I apply a GSI to the current_status attribute it looks like I have to do this in two queries? Or instead do a scan?
DynamoDB does not recommend using scan. Use it only when there is no other option and you have fairly small amount of data.
You need use GSIs here. Putting current_status in PK of GSI would result in hot
partition issue.
The right solution is to put random number in PK of GSI, ranging from 0..N, where N is number of partitions. And put the status in SK of GSI, along with timestamp or some unique information to keep PK-SK pair unique. So when you want to query based on current_status, execute N queries in parallel with PK ranging from 0..N and SK begins_with current_status. N should be decided based on amount of data you have. If the data on each row is less than 4kb, then this parallel query operation would consume N read units without hot partition issue. Below link provides the details information on this
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-indexes-gsi-sharding.html
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-modeling-nosql-B.html

Using varchar column as partition in Teradata to speedup truncate

I have a Teradata table and two columns company_name varchar(500) and case_name varchar(500).
The value of the two partitions are limited in hundreds level. But it is not controlled by me. And I can't predefine a set of their value.
It is a daily operation to truncate all data of specified company_name and case_name. So I want to use these two columns as partitions.
Is it supported to do so? And will it helps if truncate data by partition in TD? If this is not supported. Is there a best practice to truncate data by two varchar columns?
When the access to those columns is (mainly) based on where company_name = 'foo' and case_name = 'bar' you can apply a calculation like this
PRIMARY INDEX ( PIcol)
PARTITION BY
Range_N(HashBucket(HashRow(company_name,case_name)) MOD 65533 BETWEEN 0 AND 65532 EACH 1)
A delete from where company_name = 'foo' and case_name = 'bar' will access a single partition, but it's not a FastPath delete, it will be transient journaled.

Creating Dynamodb table, 3 search columns apart from partition key, is it possible?

Hi, I have created a dynamodb table but this has errors when i try to perform table.GetItem with only username (image attached)
Found this is poorly designed table, so thought of recreating a new table, my question is how to set attributes, local secondary index and global secondary index for a table with one primary key and 3 search columns.
or
Is it possible to have 3 more search columns(User_email, Username,Usertype) apart from partition key column(user_ID) in dynamodb?
The GetItem API requires both partition key and sort key. However, you can use Query API with only partition key attribute value. Sort key is not mandatory for Query API.
Get Item Rule:-
For the primary key, you must provide all of the attributes. For
example, with a simple primary key, you only need to provide a value
for the partition key. For a composite primary key, you must provide
values for both the partition key and the sort key.
You can define a maximum of 5 local secondary indexes and 5 global secondary indexes per table.
An LSI is attached to a specific partition key value, whereas a GSI spans all partition key values. Since items having the same partition key value share the same partition in DynamoDB, the "Local" Secondary Index only covers items that are stored together (on the same partition). Thus, the purpose of the LSI is to query items that have the same partition key value but different sort key values. For example, consider a DynamoDB table that tracks Orders for customers, where CustomerId is the partition key.
With a local secondary index, there is a limit on item collection
sizes: For every distinct partition key value, the total sizes of all
table and index items cannot exceed 10 GB. This might constrain the
number of sort keys per partition key value.

Order of DynamoDB multiple conditions query

I am studying DynamoDB and confuse on the order.
a. Could I use multiple conditions in the KeyConditions field of query command to do the 'AND' query? i.e. Set condition to the following keys:
hash part of primary key,
range part of primary key,
local secondary index 1,
b. If it's workable, how would DynamoDB sort the result?
DynamoDB can only use one index at a time so you can't really query using both a range primary key AND a secondary index.
The sort will be based on the index actually used.
The conditions are filtering out results and are not limited to indices.

Resources