MySQL disable & enable keys

You definitely have to pick your approach based on the engine type… optimizing for MyISAM or for InnoDB. We recently ran a benchmark comparing different ways to insert data and measured the time from before insertion and until all indices are fully restored. It was on an empty table, but we used up to 10 … Read more

How to add a user to PostgreSQL in Windows?

In pgadmin you can create a new “Login Role” and name it Eric and give it permissions graphically, or from command line you can do something like this psql -U postgres -c “CREATE ROLE Eric LOGIN NOSUPERUSER INHERIT CREATEDB CREATEROLE;” mydb see http://developer.postgresql.org/pgdocs/postgres/sql-createrole.html for information on the CREATE ROLE options.

MySQL local variables

MySQL has two different types of variable: local variables (which are not prefixed by @) are strongly typed and scoped to the stored program block in which they are declared. Note that, as documented under DECLARE Syntax: DECLARE is permitted only inside a BEGIN … END compound statement and must be at its start, before … Read more

One table or many? [closed]

I’d go for having a single table for all references, but additional tables like BookReferences and so on for metadata not applicable for all reference types. Searching and querying would not be more difficult – after all you could just create a view which aggregates all information as in the single-table solution, and then query … Read more

JPA: pattern for handling OptimisticLockException

If you get an optimistic locking exception, it means that some other transaction has committed changes to entities you were trying to update/delete. Since the other transaction has committed, retrying immediately might have a good chance to succeed. I would also make the method fail after N attempts, rather than waiting for a StackOverflowException to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)