Finding a data structure using hash tables

I learnt about “perfect square hashing” – a stacking algorithm given a S subset U subset of N-size keys, creating the O(N^2) hashing table and mapping the keys to it O(N). After creating the table each key search takes O(1).

But I want to work under a different assumption:

At the start of the algorithem we only get N, the size of the subset of keys that we will need to add to the data structure during the entire run, but we will receive the keys themselves during the run in a scattered way and we do not know what those keys will be (only they are from our U key space). We want running time O(1) (not for expectation) for every income and search during the run.

I need to propose a data structure (and algorithms) that, given N (the number of keys that will enter the data structure when used) is initialized in O(N^2) and then allows insertion and search of keys so that the probability is greater than 1/2. Each of these operations run time is O(1) for each key during the run.

I can’t find anything to work as expected, can you help me?

Are stored procedure query texts stored in any tables?

I don’t readily see anything in the sys schema objects, other than the DM_EXEC_SQL_TEXT function that requires a plan handle, but the procedures I’m trying to get their query texts from aren’t currently running. (Maybe there’s a way through their cached plans?…though the ones I’m looking for might not have a cached plan.)

Are the query texts of stored procedures stored anywhere that’s queryable?

I see sp_helptext might be an option: https://docs.microsoft.com/en-us/sql/relational-databases/stored-procedures/view-the-definition-of-a-stored-procedure?view=sql-server-ver15#TsqlProcedure

Can bruteforce attacks be prevented with tables of valid inputs?

Can this method of encryption prevent bruteforce attacks?

If I had a hypothetical table (or function) where every grammatically valid sentence (in existence, limited to some number of words) was given an associated number, e.g:

"Good morning, how are you." = 3283 "Today is a nice day." = 2183 

Then added a number (as a key), e.g:

3283 + 1234 = 4516 

Wouldn’t this final output of 4516 be effectively protected against bruteforce attacks?

Ignoring the difficulty of producing a hashtable/function capable of reducing every valid input into a single number, and the issue of sending the key 1234 securely.

Is there any way of finding the original input only from the output?

Is limiting the domain of the encryption to only valid inputs, an effective method of preventing bruteforce attacks?

If so is there any practical example of this? Why or why not?

Are there statistics on how many encounters-per-day most tables have? [closed]

Is there a consensus on how many combat encounters most players experience in a DnD 5E adventuring day?

From the DMG, pg 84:

Assuming typical adventuring conditions and average luck, most adventuring parties can handle about six to eight medium or hard encounters in a day.

However, this is more of a guideline, and doesn’t tell us how real players really play.

MDX – Sum values by keys across tables

I currently have two tables in my database, which can be simplified as follows:

GoodsStatus               GoodsPrice ID|status                 ID|price ---------                 -------- 1 |     2                 1 |    5 2 |     1       and       2 |    8 3 |     4                 3 |   12 4 |     1                 4 |    7 5 |     3                 5 |    1 

What I want to do now is to have a calculated member in SSAS to present the sum up value of the prices for goods only with a status of 1, i.e. when I run through the query I should expect a value of 8+7=15.

I have a feeling that could involve somehow finding IDs in one table with condition from the other, but I’m very new to SSAS and MDX and have since lost here.

mysqldump not importing all tables in dump file

Today I faced strange error on mysql databases. I had a replication server suddenly my replication server crashed and thatswhy I installed mysql to new server then I installed mysql. I get backup show below,

mysqldump -u root -p –compact** –databases etl > /tmp/forreplikasyon.sql

and then I copied to new server and I started for import.

nohup mysql -u root < forreplikasyon.sql &

import started and some hours passed I am checking tables on replication server some tables didn’t came. Totally I have 200 tables on my prod system but slave server shows 54 tables. Can someone help to me please about of this topic ?

** I have tried without compact parameter result is same.

What’s the best way to model similar tables with overlapping functionality?

I’m building a sports event/tournament/league management app for myself, and I’m stuck on the best way to model how Teams should relate to the different competition types.

Some background regarding the goals of the model:

  • using postgresql & graphql
  • Players earn points for participating in various events (tournaments &/or leagues) – calculated after each event.
  • Teams are made up of 1 to multiple players (depending on type of tournament or league) through a team_players join table.
  • Teams currently just have a tournament_id to join them to a tournament.
  • I’m making a separate Leagues table due to enough differences from how Tournament data is stored.
  • However, Tournament Teams & League Teams are exactly the same other than their event type & a couple quirks with how the points system calculates.

The crux of the question: Should I split out LeagueTeams to their own table & duplicate all the application logic that overlaps with TournamentTeams, or should I use one Teams table with 2 foreign keys (league_id or tournament_id)?

I feel like using one Teams table would be faster to get everything wired up on the application side initially, but I’m concerned it could end up complicating things long term…? Will it be more irritating always having to remember to query Teams by their event type in the future? Just trying to make sure I’m not missing something. Any guidance?

how to relay same table header on multiple tables?

So I have multiple comparison tables on one page. They all have the same companies names at the top for comparison on each table. Each section which has a table is comparing different data sets. How can I eliminate the need of repeating the company name on every table? I was thinking about a sticky header but since each table is broken into different sections it leaves me in the same boat (plus there’s paragraphs of text between each table).

Group not inheriting access privileges for all tables

I can’t figure out why tables created by one user can be accessed by a read-only user, but not tables created by another user.

I have a viewers read-only group with this access:

-- Grant access to existing tables GRANT USAGE ON SCHEMA public TO viewers; GRANT SELECT ON ALL TABLES IN SCHEMA public TO viewers;  -- Grant access to future tables ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO viewers; GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO viewers; 

I have two superusers in my database and one read-only user, all members of the group:

 Role name | Attributes | Member of  -----------+------------+-----------  a         | Superuser  | {viewers}  b         | Superuser  | {viewers}  readonly  |            | {viewers} 

When I create a table as user a, the readonly user can access it. But when I create the table as user b, the readonly user gets permission denied for relation.

When I check the grants, when the table is created by user a, the viewers group gets granted select automatically:

SELECT grantee, privilege_type  FROM information_schema.role_table_grants  WHERE table_name='testa' ;   grantee | privilege_type  ---------+----------------  viewers | SELECT  a       | INSERT  a       | SELECT  a       | UPDATE  a       | ... 

But if the table is created by b, the the viewers group does not have that select privilege.

I’m sure it’s simple, but I am not sure what commands will help me troubleshoot the permissions error. Where can I check to see the existing privileges and get the root of this?