Tag Info

Hot answers tagged

5

DbVisualiser could fulfill your requirements as it supports quite a number of RDBMS, including JavaDB/Derby. You can see it in action below: The only question mark is if the free version has some limitations which are a stopper for you. You can check the matrix here.


4

Use a subquery (as displayed) or CTE for that purpose: SELECT * FROM ( SELECT qid, gid FROM table1 ORDER BY date DESC LIMIT 10 OFFSET ? ) q JOIN table2 a USING (qid, gid) USING (qid, gid) is just a shortcut for ON q.qid = a.qid AND q.gid = a.gid with the side effect that the two columns are only included once in the result.


3

You can get most of those messages, but unfortunately not all. See my question on Stackoverflow regarding that. In general those messages (e.g. messages from a PRINT statement) are returned as warnings on the Statement object by the JDBC driver. To retrieve them use Statement.getWarnings() in a loop: Statement stmt = ...; stmt.execute("some sql"); ...


3

From the Connection.setAutoCommit docs: NOTE: If this method is called during a transaction and the auto-commit mode is changed, the transaction is committed. If setAutoCommit is called and the auto-commit mode is not changed, the call is a no-op. But I don't think it's very readable/obvious in your code. You should probably simply commit before ...


3

Looks like we found the culprit. Following the recent app server upgrade, we inadvertently included both ojdbc14 and ojdbc6 jars into our deployment, and evidently, the jvm picked up ojdbc14 for its Oracle DB driver. Since we removed ojdbc14 manually, this problem hasn't come up again in the past 24 hours. I assume ojdbc14 is no longer officially supported, ...


3

Already answered at a parallel thread on serverfault: http://serverfault.com/questions/345253/oracle-11-updating-blob-field-db-file-sequential-read-inappropriately-slow/345588#345588 In Oracle, LOB (including BLOB) is stored as: in-the-table LOB - if the LOB is smaller than 3900 bytes it can be stored inside the table row; by default this is ...


3

No, it's still only 1GB of total memory. The buffer is allocated as shared memory and it only allocated once, but shared between all server processes. It's basically an "error" in the memory display of the top command, which simply reports the shared memory (that only exists once) for each process.


3

Deadlocks in Oracle with logically disjoint transactions usually involve unindexed foreign keys: There are two issues associated with unindexed foreign keys. The first is the fact that a table lock will result if you update the parent records primary key (very very unusual) or if you delete the parent record and the child's foreign key is not indexed. ...


3

A quick way to determine how much memory MySQL thinks it could allocate is as follows: wget mysqltuner.pl perl mysqltuner.pl When you run this script, it will tell you what percentage of the installed RAM MySQL thinks it can safely allocate. If the answer given is over 100%, you definitely need to lower your buffer sizes. The main one to focus on are: ...


3

I would try lowering your buffer sizes. Making them as large as you have them is going to cause problems. How much memory do you have available to run these values: query_cache_size=1024M myisam_max_sort_file_size=100G myisam_sort_buffer_size=10G key_buffer_size=5000M bulk_insert_buffer_size = 4000M read_buffer_size=8000M read_rnd_buffer_size=8000M ...


2

Given this is a Windows installation, @DTest still provided the initial proper direction. Apply the following formula: Most people use this: Maximum MySQL Memory Usage = innodb_buffer_pool_size + key_buffer_size + (read_buffer_size + sort_buffer_size) X max_connections I prefer this: Maximum MySQL Memory Usage = innodb_buffer_pool_size + ...


2

Consider a parent/child table such as client/order. You can't delete a client that has an order. Say client 123 has an order A123. Fred does a delete for that order but does not commit. Then "Jane" tries to delete client 123. Since Fred's statement can potentially rollback, the client can't be deleted because it isn't allowed to the leave the order ...


2

Delete is a DML command and stores the data in redo log till the delete operation is committed. This means that if data to be removed by delete is slightly large[even though search time is less] it will take longer time as it will move data to redo log. So may be the instance when your operation took longer large no. of rows were being deleted to many ...


2

For Oracle, this seems like a good sneaky way of catching COMMITs: http://stackoverflow.com/a/6463800/790702 What he doesn't mention is that you should be able to catch the constraint violation in your code too, to stop the 2nd situation occurring.


2

There are several ways to rewrite the query and even more because both subqueries use the same base table. Not sure why the error is thrown and who is to blame, the JDBC drivers, the Foxpro or something else, so here are a few alternatives: (1) using one query for both searches: SELECT COALESCE(SUM(CASE WHEN t.btyp = 5 THEN t.netto ...


2

Your trigger is fired for each statement not for each row. In statement level triggers you can not access the new and old records. You need to change your create trigger to create a row-level trigger, rather than a statement level trigger: CREATE TRIGGER my_trigger AFTER INSERT ON table2 FOR EACH ROW -- this is the change EXECUTE PROCEDURE ...


2

The parentheses form a row-constructor, so your query returns a single column row literal, essentially an anonymous composite type. Compare: regress=> SELECT (1,2); row ------- (1,2) (1 row) regress=> SELECT 1, 2; ?column? | ?column? ----------+---------- 1 | 2 (1 row) You would've quickly realised this if you'd run the query ...


1

Both missing indexes and long-running queries are available in DMVs, with the caveat that DMVs can get refreshed on some events, such as service restart, certain sp_configure changes, etc. Here's a missing index query from Bart Duncan's blog post, Are you using SQL's Missing Index DMVs?: SELECT migs.avg_total_user_cost * (migs.avg_user_impact / 100.0) ...


1

You should be just fine extending wait_timeout Notice the maximum value for wait_timeout for MySQL 5.0, 5.1, 5.5, 5.6 Linux : 31536000 seconds (365 days, one year) Windows : 2147483 seconds (2^31 milliseconds, 24 days 20 hours 31 min 23 seconds) These maximums would not exist of mysqld could not handle them. Connection pooling only saves on overhead in ...


1

This could happen if: - Your table MYTABLE has a unique column UNIQCOL - This MYTABLE.UNIQCOL is referenced by some column in another table, say MYTABLE2.UNIQCOL_REF - This MYTABLE2.UNIQCOL_REF is not indexed. Adding a (non-unique) index to MYTABLE2.UNIQCOL_REF could then solve the problem. (You said all FKs in MYTABLE are indexed, but you didn't say ...


1

Looking at the Stored Procedure, I see something rather unnatural. DELIMITER $$ DROP PROCEDURE IF EXISTS `adam_matan`.`AddPixel` $$ CREATE PROCEDURE `adam_matan`.`AddPixel` ( GivenType VARCHAR(20), GivenPixelData BLOB ) TheStoredProcedure:BEGIN DECLARE KeepPixels,DeleteLimit,MaxID INT; SET KeepPixels = 5; SET DeleteLimit = 100; INSERT ...


1

SET SHOWPLAN [ON|OFF] is a session-level command in Sybase ASE, it's not a server-level setting (if it was a server-level setting you'd be able to alter it via sp_configure). Can you run wireshark (or something similar) on the packets being sent from the JDBC client to see if it's setting showplan on as part of the session initialization? That said - ...


1

You don't setup Fast-Start Failover in the URL. It's something that you setup on the data source using the setFastConnectionFailoverEnabled(true) function call. Per here An application enables Fast Connection Failover by calling setFastConnectionFailoverEnabled(true) on a DataSource instance, before retrieving any connections from that instance. ...



Only top voted, non community-wiki answers of a minimum length are eligible