Does Oracle guarentee that ORA_HASH is used to determine which hash partition a row is inserted, and will this be honored in the future?

I use hash partitioning for a few of my very large tables, and occasionally I have a use case where it would be convenient to have a mechanism that would return the partition name that a row would be inserted into, given a partition value.

This blog here shows that we can use ORA_HASH function for this purpose. Incidentally, it appears this page is the only page on the entire internet that explains this.

I’ve used it successfully and it works in all cases that I have tried. It seems ORA_HASH is definitely what Oracle itself uses to pick the hash partition that it inserts data into, and that at least on the current version of Oracle it is safe to use for this use case.

However there is no guarantee in the documentation that Oracle even uses it, or will continue to use it in the future. This makes me think that using ORA_HASH in this way is not safe or future proof. What if a DB is upgraded and ORA_HASH no longer behaves this way?


For reference, you can use the following SQL to return the hash partition for a given value:

SELECT partition_name FROM all_tab_partitions WHERE table_name = 'FOO'     AND partition_position = ORA_HASH('bar', n - 1) + 1 

Where 'bar' is the value you wish to analyze, and n is the number of partitions in your table. There are some edge cases when the number of partitions is not a power of 2, which is covered in the blog article linked above.

Is there performance loss in out of sequence inserted rows (MySQL InnoDB)

I am trying to migrate from a bigger sized MySQL AWS RDS instance to a small one and data migration is the only method. There are four tables in the range of 330GB-450GB and executing mysqldump, in a single thread, while piped directly to the target RDS instance is estimated to take about 24 hours by pv (copying at 5 mbps).

I wrote a bash script that calls multiple mysqldump using ‘ & ‘ at the end and a calculated --where parameter, to simulate multithreading. This works and currently takes less than an hour with 28 threads.

However, I am concerned about any potential loss of performance while querying in the future, since I’ll not be inserting in the sequence of the auto_increment id columns.

Can someone confirm whether this would be the case or whether I am being paranoid for no reasons.

What solution did you use for a single table that is in the 100s of GBs? Due to a particular reason, I want to avoid using AWS DMS and definitely don’t want to use tools that haven’t been maintained in a while.

How could a key could be inserted in a heap without increasing the size of an array?

MAX-HEAP-INSERT(A, key)     A.heap-size = A.heap-size + 1     A[A.heap-size] = -infinity     HEAP-INCREASE-KEY(A,A.heap-size,key) 

How could a key could be inserted in a heap without increasing the size of an array? With this code from Introduction To Algorithms, you can’t just randomly increase the heap size upon wish. Did I miss something? All all online lectures I have seen do no talk about this issue. Neither does the book touch this issue. Or is it that the lowest key in an array would be dropped automatically?

No HDMI no image. Need to be able to start without HDMI and if HDMI inserted show the same i was working on in VNC

I have Lubuntu 18.04 on an EB1501P MiniPC and i usually have HDMI plugged into a TV.

Sometimes i need something else connected to the TV and swap out the HDMI. Leaving Lubuntu without a HDMI output.

That in itself does no harm. But if i reboot without HDMI in it i have no picture on VNC and my user do not AutoLogin to Lubuntu beacasue of missing display.

Computer = EB1501P 64bit

GPU = NVIDIA ION

OS = Lubuntu LTS 18.04.3 64bit


I have tried to make a add to xorg.conf –allow-empty-initial-configuration and add a Virtual Desktop

nano /etc/X11/xorg.conf  Section "Device"    Identifier     "Device0"    Driver         "nvidia"    VendorName     "NVIDIA Corporation"    BoardName      "ION"    Option      "UseEDIDDpi"         "false"    Option      "DPI"                "96 x 96"    Option "AllowEmptyInitialConfiguration" EndSection  Section "Screen"    Identifier     "Screen0"    Device         "Device0"    Monitor        "Monitor0"    DefaultDepth    24    Option         "Stereo" "0"    Option         "metamodes" "1920x1080_60 +0+0"    Option         "SLI" "Off"    Option         "MultiGPU" "Off"    Option         "BaseMosaic" "off"    Option         "UseEdidDpi" "False"    SubSection     "Display"       Depth       24       Virtual     1920 1080    EndSubSection EndSection 

And The Screen can show a picture with no HDMI plugged in. But when i plug in HDMI in TV i get black screen saying “No Signal”


Then i have allso tried installing and configuring

xserver-xorg-video-dummy-hwe-18.04 

and tried adding

nano /etc/X11/xorg.conf  Section "Device"     Identifier  "Configured Video Device"     Driver      "dummy"     #Option "NoDDC" "true"     #Option "IgnoreEDID" "true" EndSection  Section "Monitor"     Identifier  "Configured Monitor"     HorizSync 31.5-48.5     VertRefresh 50-70 EndSection  Section "Screen"     Identifier  "screen0"     Monitor     "Monitor0"     Device      "Configured Video Device"     DefaultDepth 24     SubSection "Display"         Depth 24         Modes "1920x1080"     EndSubSection EndSection 

And the Screen only shows picture om TV.


I have of course messed with many different attempts with these two configurations but for no avail. Sometimes it would show picture without HDMI in VNC but wouldten work on TV if plugged in. Other times i either could only acces TV or VNC image.


this is my origional xorg.conf created by nvidia-xconfig

# nvidia-settings: X configuration file generated by nvidia-settings # nvidia-settings:  version 390.77  (buildd@lcy01-amd64-022)  Thu Sep  6 07:51:39 UTC 2018  Section "ServerLayout"     Identifier     "Layout0"     Screen      0  "Screen0" 0 0     InputDevice    "Keyboard0" "CoreKeyboard"     InputDevice    "Mouse0" "CorePointer"     Option         "Xinerama" "0" EndSection  Section "Files" EndSection  Section "Module"     Load           "dbe"     Load           "extmod"     Load           "type1"     Load           "freetype"     Load           "glx" EndSection  Section "InputDevice"     # generated from default     Identifier     "Mouse0"     Driver         "mouse"     Option         "Protocol" "auto"     Option         "Device" "/dev/psaux"     Option         "Emulate3Buttons" "no"     Option         "ZAxisMapping" "4 5" EndSection  Section "InputDevice"     # generated from default     Identifier     "Keyboard0"     Driver         "kbd" EndSection  Section "Monitor"     # HorizSync source: edid, VertRefresh source: edid     Identifier     "Monitor0"     VendorName     "Unknown"     ModelName      "SAMSUNG"     HorizSync       26.0 - 81.0     VertRefresh     24.0 - 75.0     Option         "DPMS"     Option         "DPI" "96 x 96" EndSection  Section "Device"     Identifier     "Device0"     Driver         "nvidia"     VendorName     "NVIDIA Corporation"     BoardName      "ION"     Option      "UseEDIDDpi"         "false"     Option      "DPI"                "96 x 96" EndSection  Section "Screen"     Identifier     "Screen0"     Device         "Device0"     Monitor        "Monitor0"     DefaultDepth    24     Option         "Stereo" "0"     Option         "metamodes" "nvidia-auto-select +0+0 {AllowGSYNC=Off}"     Option         "SLI" "Off"     Option         "MultiGPU" "Off"     Option         "BaseMosaic" "off"     Option         "UseEdidDpi" "False"     SubSection     "Display"         Depth       24     EndSubSection EndSection 

What do i need to do to be able to VNC into Lubuntu without out HDMI. And to use the same image on my TV if i suddenly plugin the Cable ?

Best regards and ty for reading Darkyere

Ubuntu remembers every drive ever connected and every dvd ever inserted and PCmanFM shows it in folder panel

I am using PCManFM 1.2.5 as file manager on Ubuntu 18.04.2. When I go to my media folder, there I find listed the names of every external drive I ever connected and every disk I ever inserted in my dvd drive and even for my WLAN stick a separate entry for every time I connected it to the computer. How can I get Ubuntu to empty this list daily or forget about the devices as soon as they get disconnected?

Can insertMultiple method return all inserted auto-increment ids?

I have to insert rows in two custom tables (which have a many-to-many relation).

I want to use batch insert (i.e. insertMultiple method in Magento 2) for the parent and child table both.

The issue is that if I will do batch insert in the parent table using an insertMultiple method, will it return all inserted ids to be used in the child (relation) table?

Please suggest any feasible and reliable solution.

what are the tables being inserted when import product in Magento2?

I want to know what are the tables being inserted while import product in magento2.

or what are the main table to be inserted for showing products in home page( don’t think big. just to display in UI)

I have 1 Million of data, and I can’t upload a file which is more than 2mb.

It is not possible to split my file and insert.

I can create insert into ... query from csv file if I know the table names and its relations.

can anyone know, please answer me

Finding rank of newly inserted node in AVL tree augmented with rank of node

My prof was talking about how to augment a tree to efficiently find the key with a given rank. On the way to getting the right answer (store the size of the subtree rooted at each node), he proposed augmenting each node with it’s rank. That way finding the node with a certain rank is a simple binary search. But he said this wouldn’t work because insertion would be $ \Theta(n)$ . I understand that this is because in the worst case the newly inserted node has rank 0 and so the rank of each node in the tree must be incremented by 1. What I am interested in knowing is an algorithm for computing the rank of a newly inserted node. At first I thought that if a node $ n$ is inserted to the left of a leaf $ l$ with rank $ k$ then the rank of $ n$ is $ k-1$ , or $ k+1$ if inserted right of $ l$ . I found a counter example to that so I know it is not the case. So how would this be done?

Update sales order immediately after inserted

I want to update the sales order right after it is inserted.

I want to reflect the change on the sales order conformation email also which is going to the customer.

So i have prepared the below code and inserted into \Magento\Sales\Model\Order\Email\Sender::checkAndSend

$  objectManager = \Magento\Framework\App\ObjectManager::getInstance();     $  resource = $  objectManager->get('Magento\Framework\App\ResourceConnection');     $  connection = $  resource->getConnection();     $  sqlx = "SELECT * FROM sales_order ORDER BY entity_id DESC LIMIT 1";     $  connection->query($  sqlx);     $  resultx = $  connection->fetchAll($  sqlx);     foreach($  resultx as $  resulx) { $  entityid  = $  resulx['entity_id']; }     $  sql = "SELECT * FROM sales_order_item WHERE order_id='$  entityid'";     $  connection->query($  sql);     $  results = $  connection->fetchAll($  sql);     foreach($  results as $  result)     {         $  item_id = $  result['item_id'];         $  fullopt = $  result['product_options'];         $  needle = 'Shoe Size';         if (strpos($  fullopt, $  needle) !== false){             $  pieces = explode('Shoe Size","value":"', $  fullopt);                     $  sizenum = explode('","option_id', $  pieces[1]);             if(strpos($  fullopt, '"value":"EU"') !== false) {                 $  rsizenum1 = $  sizenum[0]+31;                 $  finalque = $  pieces[0].'Shoe Size","value":"'.$  rsizenum1.'","option_id'.$  sizenum[1];             }             else if(strpos($  fullopt, '"value":"UK"') !== false) {                 $  rsizenum2 = $  sizenum[0]-1;                 $  finalque = $  pieces[0].'Shoe Size","value":"'.$  rsizenum2.'","option_id'.$  sizenum[1];             }             else{                 $  finalque = $  fullopt;             }             $  upsql = "UPDATE sales_order_item SET product_options='$  finalque' WHERE item_id='$  item_id'";             $  connection->query($  upsql);         }     } 

The issue is that this dosent update the sales order emal which is goingout and also every time my order gets updated this is running again.

I only want this to run one time after order is inserted.

Anyone can give me a clue?

Want to refactor working methods that return id of inserted row of query for country, city, and address tables

These are the 3 methods and I am just wondering what would be the right way to remove all the duplication? I want to use this example to learn how to do it to clean up the rest of my code. Please note that I am not allowed to use any external libraries or frameworks for this project outside of the standard java libraries. Thank you.

private void handleSaveButton() throws SQLException {     countryId = getCountryId();     cityId = getCityId();     addressId = getAddressId(); }  /**  *  * @return @throws SQLException  */ private long getCountryId() throws SQLException {     getConnection();     param = toTitleCase(countryTextField.getText());     System.out.println("country param: " + param);     String query = "insert into country (country) values (?)";     ps = con.prepareStatement(query, Statement.RETURN_GENERATED_KEYS);     ps.setString(1, param);     try {         ps.executeUpdate();         rs = ps.getGeneratedKeys();         rs.next();         primaryKey = rs.getLong(1);         System.out.println("inserted country id: " + primaryKey);     } catch (SQLIntegrityConstraintViolationException e) {         ps = con.prepareStatement("select countryId from country where country = ?");         ps.setString(1, param);         rs = ps.executeQuery();         rs.next();         primaryKey = (long) rs.getInt(1);         System.out.println("existing country id: " + primaryKey);     } finally {         closeConnection(ps);     }     return primaryKey; }  /**  *  * @return @throws SQLException  */ private long getCityId() throws SQLException {     getConnection();     param = toTitleCase(cityTextField.getText());     System.out.println("city param: " + param);     String query = "insert into city (city, countryId) values (?, ?)";     ps = con.prepareStatement(query, Statement.RETURN_GENERATED_KEYS);     ps.setString(1, param);     ps.setLong(2, countryId);     try {         ps.executeUpdate();         rs = ps.getGeneratedKeys();         rs.next();         primaryKey = rs.getLong(1);         System.out.println("inserted city id: " + primaryKey);     } catch (SQLIntegrityConstraintViolationException e) {         ps = con.prepareStatement("select cityId from city where city = ?");         ps.setString(1, param);         rs = ps.executeQuery();         rs.next();         primaryKey = (long) rs.getInt(1);         System.out.println("existing city id: " + primaryKey);     } finally {         closeConnection(ps);     }     return primaryKey; }  /**  *  * @return @throws SQLException  */ private long getAddressId() throws SQLException {     getConnection();     param = toTitleCase(addressTextField.getText());     System.out.println("address param: " + param);     String query = "insert into address (address, cityId, postalCode, phone) values (?,?,?,?)";     ps = con.prepareStatement(query, Statement.RETURN_GENERATED_KEYS);     ps.setString(1, param);     ps.setLong(2, cityId);     ps.setString(3, postalTextField.getText());     ps.setString(4, phoneTextField.getText());     try {         ps.executeUpdate();         rs = ps.getGeneratedKeys();         rs.next();         primaryKey = rs.getLong(1);         System.out.println("inserted address id: " + primaryKey);     } catch (SQLIntegrityConstraintViolationException e) {         ps = con.prepareStatement("select addressId from address where address = ? and cityId = ?");         ps.setString(1, param);         ps.setLong(2, cityId);         rs = ps.executeQuery();         rs.next();         primaryKey = (long) rs.getInt(1);         System.out.println("existing address id: " + primaryKey);     } finally {         closeConnection(ps);     }     return primaryKey; }