Questions tagged [uuid]

A Universally Unique Identifier (UUID), GUID in Microsoft parlance.

Filter by
Sorted by
Tagged with
8
votes
2answers
21k views

How do I install/enable the uuid-ossp extension on Postgres 9.3?

I’m using Postgres 9.3 on Ubuntu Linux 14.04. How do I install/enable the uuid-ossp extension? I first verified the contrib package was installed … root@prodbox:/home/rails/myproject# apt-get ...
0
votes
1answer
1k views

generate array of unique uuid in postgreSQL

I would like to insert array of unique uuid values in table with uuid column as primary key. Table structure is CREATE TABLE Organisation (uuid id PRIMARY KEY DEFAULT uuid_generate_v4()); e.g. I ...
0
votes
1answer
28 views

About UUID and generators in PostgreSQL

I'm thinking to use UUID as PK for all tables into my new PostgreSQL database, for such a goal I will be using uuid_generate_v5 and uuid_ns_dns or uuid_ns_url functions, but I have some doubts: is ...
0
votes
1answer
24 views

Add jsonb key/value pair with uuid

I am trying to add a new key value pair to a jsonb array and I am having some difficulties in doing it. What I am trying to add is a key id with a uuid value This is how my data looks right now: { ...
0
votes
0answers
21 views

UPDATE with UUID() sets all rows with the same value

Having a table t1 with the field f1 BINARY(16) the following command updates all rows with the same uuid value. UPDATE t1 SET f1 = UNHEX(REPLACE(UUID(), '-', '')); OK, somehow I must have totally ...
0
votes
1answer
33 views

How to assign GUID to batches of data based on row counts and tunable batch size

I need to assign batches of rows a common GUID id (for consumption by an external process). Below is a simplified setup describing what I'm looking for: BASE_TABLE represents one of pre-existing ...
0
votes
1answer
412 views

MySQL column that auto generates data, longer than UUID

My friend has the problem as shown below. He asked at StackOverFlow and there is no reply yet till now so I wish to help him to try the luck here. Thanks for everyone that helps. "I would like to ask ...
1
vote
1answer
84 views

MariaDB Uuid as Primary Key Performance Problem / Tweaks

im upgrading our mariadb database from PRIMARY KEY INT AUTO_INCREMENT to UUID PRIMARY KEY. We have around 80 tables with multiple relations between them. I've build a migration script to change the id ...
0
votes
1answer
20 views

is it relatively safe to union two tables with UUID PK? [closed]

I want to union two tables whose primary keys are UUID(V4) and I want to preserve them in the result. I work with PostgreSQL Is it safe to do this? What are the pitfalls may be encountered?
1
vote
1answer
1k views

Convert SID string to varbinary(85)

My ssrs server was moved to a different domain because of which the Users table need to be updated with new SID current sid: S-1-5-21-39949945-591092532-1226208319-1007 I want to convert this sid ...
3
votes
1answer
4k views

How to fix issue uuid_generate_v1() does not exist in postgresql , actually i have the function under public schema

org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [select * from da.test_get(cast(? as integer),cast(? as text),cast(? as text),cast(? as text),cast(? as text)...
1
vote
1answer
2k views

Cannot run 'uuid-ossp' functions even when it's activated

I want to generate a v4 uuid in PostgreSQL using the extension uuid-ossp, so in psql I ran: CREATE EXTENSION "uuid-ossp"; Then I ran SELECT uuid_generate_v1(); or SELECT uuid_generate_v4(); but I ...
0
votes
1answer
919 views

MySQL is pretty slow after 50-100k rows whats happen?

i have trying now a lots of time, and i try to find a way there make sense to find out of my problem, but this problem stil make a lot perfumes issues. i testing it of on a developer server ( 2 cores,...
1
vote
1answer
110 views

How to set uuid-ossp as a default extension for whole server?

I installed uuid-ossp for the default PostgreSQL database (postgres) using the following sql commands but whenever I create a new database I am forced to run the same commands once again for every new ...
0
votes
1answer
484 views

Why is there no max(uuid)/min(uuid) function?

Why can I use a UUID to sort rows: SELECT uuid_nil() ORDER BY 1; But I cannot compute the maximum value: SELECT max(uuid_nil()); [42883] ERROR: function max(uuid) does not exist Hint: No function ...
0
votes
3answers
1k views

MySQL UUID() behavior

4 years ago, I answered a question on SO, "how to set an UUID for each row in bulk". I answered, after trying it, UPDATE table SET uuidcol = UUID(); It worked for me, but about half (it ...
5
votes
3answers
151 views

Should I convert the frontend generated UUIDv6 to binary(16) for use in SQL Server as the clustered primary key?

Background As suggested by the front-end developer, I looked into using UUID as the primary key for a bunch of tables in our new system. From learning the pros and cons of random vs. sequential UUIDs, ...
4
votes
2answers
1k views

Clustered Sequential GUID Primary Key vs Non-Clustered GUID and Clustered Sequential ID Primary Keys

I'm trying to figure out what the optimal solution is in regards to size and performance when using GUIDs as a primary key. The main reason for wanting GUIDs is that it's more appropriate in our micro-...
12
votes
3answers
4k views

Does Postgres offer a feature like “NEWSEQUENTIALID” in MS SQL Server to make UUID as primary key more efficient

Microsoft SQL Server offers the NEWID command to generate a new GUID (the Microsoft version of UUID) value that can be used as a primary key value (in their uniqueidentifier data type). These are not ...
92
votes
2answers
134k views

Default value for UUID column in Postgres

In Postgres 9.x, for a column of type UUID, how do I specify a UUID to be generated automatically as a default value for any row insert?
38
votes
3answers
26k views

How should I index a UUID in Postgres?

I'm new to PostgreSQL and somewhat new to databases in general. Is there an established way of how we should index UUID values in Postgres? I'm split between using hashing and using a trie, unless ...
0
votes
1answer
51 views

Best practice for exposing record IDs to API users

I am extending an API to include the ability to retrieve and update a specific record after the record is created by the user. Currently, these records are created with an auto generated integer key,...
5
votes
2answers
17k views

Casting an array of texts to an array of UUIDs

How can I cast an array of texts into an array of UUIDs? I need to do a join between two tables: users and projects. The users table has an array field named project_ids containing the project IDs ...
2
votes
1answer
2k views

mariadb Unknown system variable 'server_uuid'

Im trying to setup replication between mariadb(10.1.31-MariaDB - MASTER) and mysql(5.7.12-log - SLAVE). After executed the start slave, I got the below error. Fatal error: The slave I/O thread ...
3
votes
2answers
1k views

GUID vs Identity on a table performance [duplicate]

My question is using a guid(data type unique identifier) versus using identity specification(data type int). Are there any articles where it talks about why you would use one versus another? I'm at a ...
4
votes
1answer
1k views

UUID or BIGSERIAL Foreign Keys Postgres

I have 8 tables which use UUID Primary Keys and 7 of them have UUID Foreign Keys. Would it be better for performance to use BIGSERIAL instead of UUID?
-1
votes
3answers
558 views

ID, UUID and “deleted_at” columns, How to avoid performance degradation?

Consider this table, but with thousands of records, on PostgreSQL: | id | uuid | color | ... | deleted_at | |----|---------|----------|-----|---------------------| | 1 | 4fc1... | red ...
1
vote
1answer
142 views

Started using UUID's as primary key, would like to execute union of entities with BigSerial Primary Key

Some of my newer tables are now using UUID type fields as PKey and older tables are still using bigserial. I have several tables (let's call them entities) I would like to query returning the primary ...
1
vote
0answers
172 views

SQL Server Partition. How would splitting range with Guid work?

I have a very large table in my database, and it has a GUID column called Group_Id. This Group_Id has a pretty even split of data, and it would be beneficial to partition the table by this column. ...
3
votes
1answer
2k views

`uuid_generate_v1mc` in Postgres “uuid-ossp” module: What is random multicast MAC address?

The uuid-ossp module extension (plugin) for Postgres offers this alternative method for generating a UUID value. uuid_generate_v1mc() This function generates a version 1 UUID but uses a random ...
0
votes
1answer
229 views

Universally converting UUID to IDs

what are the best practices in Postgres for globally converting UUIDs into IDs. I'm currently using both UUIDs and IDs in my schema. The intent is for UUIDs to be exposed to the public (for URLs et.) ...
2
votes
1answer
108 views

UUID as primary key and download ID

I'm designing a Django Rest Framework API with PostgreSQL. In the database I'll be recording information about documents which can be requested for download. I want the request to include a unique id, ...
0
votes
1answer
187 views

UUID array declared in stored procedure, on access throws explicit type casts needed

I have a stored procedure where I have declared an array of UUIDs, on using that variable, it throws casting exception. create or replace function test.test_function(max integer, interval interval) ...
2
votes
3answers
552 views

Index or View of all UUIDs in Postgres DB?

I have a Postgres database with about 35 tables of varying sizes. Every table has an auto incrementing integer primary key, as well as a column of native Postgres uuid data type recording Version 4 ...
0
votes
1answer
62 views

Where clause in select does not work with Inequality of guid

I want to query our CRM Db. I have a backup of CRM Db and the existing one. There is a custom entity,in both of them I have created. Some of my custom entity records has deleted from the existing db. ...
0
votes
1answer
54 views

NON-Random UUID keys in custom distributed DB

Is there any reason other than security for using random (or even semi-random) UUIDs as primary keys to database records? Is there any reason why I should not WANT to be able to use the UUID to ...
1
vote
1answer
209 views

Can one part of a multi-column primary key be used across tables?

I want to use SQLite as file format for my app, a reporting program. Below is an idea of the kind of schema I'll use (just the first few tables). There will be one report per file and all tables are ...
3
votes
1answer
1k views

best index type for uuid in postgres 11

I realize a similar question has been asked multiple times but all the ones I can find are from 2014/2015 and many versions of postgres ago. I'm on postgres 11. I'm introducing a new primary key for ...
1
vote
1answer
5k views

Postgres support for UUID [closed]

My understanding is that Postgres supports UUID data type out-of-the-box. I'm running Postgres on Amazon RDS with Engine version 10.6 and am scratching my head as to why the following commands are not ...
0
votes
0answers
1k views

How to pass array of UUIDs *OR* empty array and return implicit (inner join)?

How would I pass a list that is either full of UUIDs or empty, then return only joined records with those id values or all records if empty? This question (Casting an array of texts to an array of ...
13
votes
4answers
4k views

What can go wrong using the same sequence across multiple tables in postgres?

We are considering using a shared sequence to assign ids to primary keys for all of the tables in our database. There are about 100 of them. Only a couple are inserted to frequently and regularly. We ...
6
votes
2answers
2k views

SQL Server: Create New GUID Values for Existing Index

I have an existing table with about 6 million rows. The relevant columns are: ID int not null PK Key uniqueidentifier not null Read/write on this table by Key lookup is probably something like 100 ...
2
votes
1answer
2k views

Are there any performance differences with a GUID vs INT clustered indexed column, especially with joins on those columns?

Basically what the title says: What are the differences in performance (if any) between using a clustered index on a GUID column vs a clustered index on an INT column, especially when those columns ...
0
votes
1answer
407 views

Primary key and index column for Merge replication- Id vs GUID

I currently am revising the tables structure for a few geographically distributed databases- all tables currently have a UUID that is set as primary key. Merge subscription is currently (and in the ...
4
votes
1answer
12k views

In Postgres, how to select by a column of type UUID [closed]

I have a DB table that someone else created, its PK is a single column of type 'uuid'. I'm struggling to perform a simple select by that column. Examples I have tried with no success: select from ...
1
vote
1answer
2k views

In Postgres 10, how do the choice of SERIAL or UUID type as primary key affect replication, if at all?

A popular answer on SO states that using UUIDs as primary keys has the following benefit: Makes replication trivial (as opposed to int's, which makes it REALLY hard) I have been unable to find ...
14
votes
1answer
10k views

PostgreSQL two different ways to generate a UUID: gen_random_uuid vs uuid_generate_v4?

What is the difference between the following two functions gen_random_uuid() provided by pgcrypto extension uuid_generate_v4() provided by uuid-ossp extension Are they both the same behind the ...
-2
votes
1answer
164 views

Difference between UUID UUID + Id

what is the difference between these 2 solutions: UUID as primary key VS auto-increment ID as primary key + new UUID field
3
votes
1answer
3k views

PostgreSQL UUID Literal: ERROR: syntax error at or near

Whever I use a UUID as a literal, I get SELECT a82857b6-e336-4c6c-8499; ERROR: syntax error at or near "-" I thought it might be an encoding issue, but that doesn't seem to be it.
3
votes
2answers
3k views

Can IDENTITY COLUMNS generate UUIDs?

I'm just wondering if either the spec of the implementation (PostgreSQL) provides for generating identity columns from UUIds or the like. Is there an alternative to, CREATE TABLE f ( id uuid ...