In order to leave processess running in background under MacOS while you don't use your computer you must configure some power management settings. This is needed because MacOS will sleep the computer if the keyboard or mouse are not used after a time.
You can configure this from the graphical interface, but if you need to setup this to a remote computer (or if you think that using GUIs is just not geek enough for you) the commands to do this are:
pmset sleep 0
pmset disksleep 0
To see the current settings:
pmset -g
Tuesday, June 1, 2010
Insert issues on SQLite3
If you are inserting a large number of entries in a SQLite3 table, it is highly recommended that the table doesn't have any indexes (primary keys included), because in indexed tables the time that takes each new insert becomes longer. In contrast, if the table isn't indexed, the insert time is always the same. If you need and indexed table, you could always add indexes after massive insertions.
SQL list each element one time
If you have a table like this :
You can list each id one time with the following query :
This work in MySQL
CREATE TABLE data { id INTEGER , type INTEGER }
You can list each id one time with the following query :
SELECT id , MIN( type ) FROM data GROUP BY id
This work in MySQL
SQL group count with conditions
If you have a table like this :
You can list the times that each id appears in the table with the following query :
Now, if you want to list the same data but adding some condition, like list only the elements that appears more than one time, then you can perform that with the help of some aliases and nested query :
This work in MySQL
CREATE TABLE data { id INTEGER , type INTEGER }
You can list the times that each id appears in the table with the following query :
SELECT id , count( type ) FROM data GROUP BY id
Now, if you want to list the same data but adding some condition, like list only the elements that appears more than one time, then you can perform that with the help of some aliases and nested query :
SELECT d.id , d.c FROM (SELECT id , count( type ) as c FROM data GROUP BY id ) d WHERE d.c > 1
This work in MySQL
Subscribe to:
Comments (Atom)