postgresql – Can I GRANT SELECT on all schemas in a database?

I need to create role users of which can only read (select) data.
I can do it for a particular schema.
But I need it to work with all existing and future schemas (existing at least). How can I do it?

I’ve tried

GRANT select ON DATABASE mzia TO qaread;

But it says that I can’t:

0LP01 invalid_grant_operation

Azure SQL – is it possible to assign CREATE PROCEDURE permission for the master database?

I am trying to add a stored procedure to the master database (I deliberately am trying this for the master db) on Azure SQL. Is this possible? I suspect the answer is “no”, but I’d like to see some confirming documentation on it if that is the case.

What I’ve tried so far:

Here’s the procedure (just as a test):

CREATE PROCEDURE dbo.blah AS RETURN 0;

I’ve tried the above using the admin login, and it failed:

Msg 262, Level 14, State 18, Procedure blah, Line 2 (Batch Start Line 21)
CREATE PROCEDURE permission denied in database 'master'.

I then tried to create another login and user and then assigned them to the “dbmanager” role and tried the create procedure again – same failure.

Total logical reads per database on SQL Server

Is there a way to get the total running logical readswrites per database from last restart? Trying to monitor what dbs are most used and if that changes over time.

time series database – Entries with same timestamp in GridDB


Your privacy


By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.




database design – Creating B2B Architecture proposal

Which are the steps to start to create a B2B architecture proposal?

Hi there, I’m beginner in my own project business about software So one of my clients required me propose a B2B architecture on Magento 2 OnPremise, bassed in their own sellers, servers and requirements of them.

I have no clue where start, so I figure I need to know check about recurring customers, visitors per day, concurrent visitors, orders, etcetera…

Finally; also purposing him which kind of servers hardware requirements we will need it.

Thank you in advance!

postgresql – psql: FATAL: database “postgres” does not exist after failed upgrade from 11 to 13

psql: FATAL: database “postgres” does not exist after failed upgrade from 11 to 13
postgresql archlinux
Ok, it is my fault for not ignoring postgresql upgrades on archlinux. I have the following problem and this is how it started in chronological order:

1 – I upgraded packages, postgres included. 2 – When I restarted the server, I got an error saying that the database files are incompatible.

Here is where it gets weird:

3 – I check PG_VERSION and the data dir shows 11, I build an older version of postgresql-old-upgrade to match 11 and follow the instructions here:

https://wiki.archlinux.org/index.php/PostgreSQL#Upgrading_PostgreSQL

4 – pg_upgrade fails, the reason is because somehow, the old data fails have version 13 in globals/pg_control according to pg_controldata.

5 – I make additional copies of my old data dir and use pg_resetwal from postgres 11 binaries, pg_control now shows the correct version number so I start the server without errors but I did noticed that it removed a bunch of wal files.

6 – I try to use psql but I get psql: FATAL: database “postgres” does not exist

If I try to run createdb postgres I get an error saying that database template1 does not exist.

So far I tried matching the next and old xids with pg_resetwal, but nothing, is my data completely lost? I didn’t do anything other than upgrading postgres so I wonder how pg_control got changed to version 13

How can I find which table belongs to which two users in a MySQL database that stores user messages?

I’m building a chat application in which I want to store user messages in a MySQL database. I have came up with the solution of creating a seperate database for messages and creating tables for each conversation between users. One example table would look like this:

+-----------------+-----------------+------+-----+---------+----------------+
| Field           | Type            | Null | Key | Default | Extra          |
+-----------------+-----------------+------+-----+---------+----------------+
| message_count   | bigint unsigned | NO   | PRI | NULL    | auto_increment |
| message_content | varchar(2000)   | YES  |     | NULL    |                |
| sent_by         | varchar(32)     | YES  |     | NULL    |                |
| sent_at         | datetime        | YES  |     | NULL    |                |
+-----------------+-----------------+------+-----+---------+----------------+

But how would I be able to figure out which table should I load for a given two users? I could store the usernames of both participants of the chat room in a column named “participants” seperated by a whitespace and use a query that looks like SELECT FROM chats WHERE participants LIKE username, but that does not sound like a healthy solution at all.

seo – How does a search engine discover/crawl a website page when requested URL loads the content via database?

I am creating a new blog website in Django. All the posts and their details are stored inside an SQLite database (one that comes default with Django). Once a post’s URL is requested, the server returns the webpage which contains the post loaded from the database. My question is, since the webpages do not exist until someone types in the URL, how will a search engine such as Google crawl the website and make it show up in the search results if it is relevant to the search? Is it necessary to provide a sitemap for this to happen?

SQL Server – Is there a way to query the Size and Space available settings for each Database, including system databases on an instance?

I am trying to query the default database properties as seen in the picture below for all databases on an instance, including system databases.

I’ve used various scripts such as the following, but I’m not sure exactly where those two fields are stored.

SELECT 
      database_name = DB_NAME(database_id)
    , log_size_mb = CAST(SUM(CASE WHEN type_desc = 'LOG' THEN size END) * 8. / 1024 AS DECIMAL(8,2))
    , row_size_mb = CAST(SUM(CASE WHEN type_desc = 'ROWS' THEN size END) * 8. / 1024 AS DECIMAL(8,2))
    , total_size_mb = CAST(SUM(size) * 8. / 1024 AS DECIMAL(8,2))
FROM sys.master_files WITH(NOWAIT)
WHERE database_id = DB_ID() -- for current db 
GROUP BY database_id

enter image description here

Thank you for your help.

sql server – Azure SQL Database throwing error 1132 “The elastic pool has reached its storage limit” error, even if it’s not full

I’m trying to execute the following (sample) batch in an Azure SQL Database inside an Elastic Pool:

drop table if exists (dbo).(InsertTest);
create table (dbo).(InsertTest) (
    (id) uniqueidentifier,
    (filler) nvarchar(max)
);

insert into (dbo).(InsertTest) ((id), (filler))
select top 1000 newid(), replicate('X', 2048)
from (sys).(objects) as (T1)
    cross join (sys).(objects) as (T2);

/* drop table if exists (dbo).(InsertTest); */

But the insert statement fails with the error message:

Msg 1132, Level 16, State 1, Line 1
The elastic pool has reached its storage limit. The storage used for the elastic pool cannot exceed (51200) MBs.

I tried to see if I ran out of space by running the query

select
    (type_desc)         as (file_type),
    (size) / 128        as (size_in_MB),
    (max_size) / 128    as (max_size_in_MB)
from (sys).(database_files);

but it seems that I still have space left.

file_type size_in_MB max_size_in_MB
ROWS 320 256000
LOG 584 1048576
FILESTREAM 0 0

What can I do about it? Am I missing something?