Difference between revisions of "Useful SQL"
From Roaring Penguin
Line 1: | Line 1: | ||
+ | You can run the following SQL commands from the commend line by prefixing them with | ||
+ | psql -U spam spam -c "<actual command>" | ||
PostgreSQL check a variable from command line: | PostgreSQL check a variable from command line: | ||
− | + | SELECT * FROM settings WHERE variable = 'BayesDBFormat'; | |
Delete domain whitelists: | Delete domain whitelists: | ||
− | + | DELETE FROM domain_action WHERE action = 'allow-always'; | |
Delete sender whitelists: | Delete sender whitelists: | ||
− | + | DELETE FROM sender_action WHERE action = 'allow-always'; | |
Find held message size for specific incidents | Find held message size for specific incidents | ||
− | + | SELECT length(msg) FROM held_messages WHERE incident_id in (518210, 518197, 519116); | |
Find count of messages in incidents table | Find count of messages in incidents table | ||
− | + | SELECT status, count(*) FROM incidents group BY status; | |
<div style="float:right; clear:both; margin-right:0.5em">[[Support Wiki | [Home]]]</div> | <div style="float:right; clear:both; margin-right:0.5em">[[Support Wiki | [Home]]]</div> | ||
[[category:All]][[category:Troubleshooting]] | [[category:All]][[category:Troubleshooting]] |
Revision as of 14:26, 11 September 2015
You can run the following SQL commands from the commend line by prefixing them with
psql -U spam spam -c "<actual command>"
PostgreSQL check a variable from command line:
SELECT * FROM settings WHERE variable = 'BayesDBFormat';
Delete domain whitelists:
DELETE FROM domain_action WHERE action = 'allow-always';
Delete sender whitelists:
DELETE FROM sender_action WHERE action = 'allow-always';
Find held message size for specific incidents
SELECT length(msg) FROM held_messages WHERE incident_id in (518210, 518197, 519116);
Find count of messages in incidents table
SELECT status, count(*) FROM incidents group BY status;