mirror of
https://github.com/urbanguacamole/torrent-paradise
synced 2024-10-31 21:20:13 +00:00
Add more handy SQL snippets
This commit is contained in:
parent
1f9b37b724
commit
49fae72182
@ -15,3 +15,12 @@ CREATE MATERIALIZED VIEW fresh AS
|
||||
max(completed) AS c
|
||||
FROM trackerdata
|
||||
GROUP BY infohash;
|
||||
|
||||
--- size of table
|
||||
SELECT pg_size_pretty(pg_total_relation_size('"<schema>"."<table>"'));
|
||||
|
||||
--- count rows
|
||||
SELECT reltuples::bigint AS estimate FROM pg_class where relname='mytable';
|
||||
|
||||
--- create fulltext table
|
||||
CREATE TABLE search AS select torrent.*, fresh.s as s, fresh.l as l, to_tsvector(torrent.name) as vect from torrent inner join fresh on fresh.infohash = torrent.infohash;
|
Loading…
Reference in New Issue
Block a user