Skip to content

Searching with a lateral join extremely slow

I’m currently implementing a search function in one of our grids and when doing so, my query goes from running in 1 second or less to running in about 16 seconds (I’ve added suggested indices, etc). The data returned from this query will be the parent’s id, parent’s name, most recent c…

SQL / Hibernate insert only if url not exists

I have a list of urls and a table that contains urls. I want to only insert if the url is not in the table. After the insert the Data-table should be contain: My current attempt is to have a method findByURL(url):List and a call this method for every URL in the list. If the returned list is empty I

Best way to insert into multiple tables in a cluster

Suppose I have a wide table (CUSTOMERS) that contains lots of columns (CUSTOMER_ID, FIRST_NAME, LAST_NAME, DOB, ADDRESS, PHONE_NUMBER, etc). This table is used in several full table scans, each of which selects only a small number of the columns of the table. Since this table is very large, these full table s…

Count occurrences in SQL

I have a table with the following data And I would like to have for each ID how many occurrences of each type there are Is there a way in SQL (something like a pivot table) Answer I would recommend conditional aggregation. This is a cross-database solution that is more flexible than vendor-specific solutions …

Passing Multiple Values To PL/SQL Input

I have an Oracle package which contains a function. This function has 3 inputs. I need to pass multiple values to each input. I could automate a process which runs it multiple times with each combination of variables but I would like to only make one call to the database. Simplified Code Answer Pass it with q…