Tag Info

New answers tagged

0

For a table created like this: CREATE TABLE public.delete_key_bigserial (id bigserial PRIMARY KEY NOT NULL); ... both my queries (as well as pgAdmin, psql or any other decent client) would find the PK constraint. If it's not there, you removed it somehow. Note that my first query in the previous answer only returns the column it is the PK and a serial ...


0

If you are running away from MySQL and hoping that PostgreSQL is better, then first consider what type of UUIDs you have. If they are the 'sequential variant' (Type 1), and if you have some clustering by time, then MySQL (or any database) can take advantage of it. Here is a discussion of such: http://mysql.rjweb.org/doc.php/uuid Although MySQL does not ...


0

MySQL While the MySQL Documentation literally says Typically, the clustered index is synonymous with the primary key, they are not one and the same. Please keep in mind that the clustered index (called gen_clust_index) was created in such a way that the index pages for the PRIMARY KEY and the table's row data coexist in the same pages. Having wide PRIMARY ...


1

I have 3 solutions for you: Direct reference of sequence and using concat One possible solution is to reference the seqence in insert statement directly and prepend your node-id. A similar question including answer you can find here: http://stackoverflow.com/a/17925601/4206293 Using a UUID Another possible solution is, if you don't need you node-id in ...


4

Your query would fail, because the standard name of an integer is "integer", not "int". You can avoid this kind of error by comparing the internal regtype OID instead of a text representation. Many basic data types have several alias names, they all resolve to the same internal registered type. That aside, you can largely simplify and improve: SELECT ...


1

If A and B derive from different domains, the intersection between them will be the empty set, so A AND B (the intersection) has no usefulness. If they derive from the same domain you could have some intersections or, like the previous example, none, for example if you have two numeric attributes, the first with a 20-25 Check costraint and the second with ...


1

If the UUIDs are not the sequential variant, then inserting them in the order they are created will cause some random leaf node in the index to be dirtied for each row inserted. Once the index is large enough, this will kill write performance on spinning hard drives, as it won't be able to consolidate the writes for efficient writing to disk.


1

Super Keys : Super key stands for superset of a key. A Super Key is a set of one or more attributes that are taken collectively and can identify all other attributes uniquely. For Example, We are having table Book (BookId, BookName, Author) So in this table we can have  (BookId)  (BookId,BookName)  (BookId, BookName, Author)  (BookId, ...


0

In your scenario, you have two 'entities': Employees. These are stored in table Employee Details. Schedules. Stored in table Schedules. A schedule stores an Employee ID and other information. What you want to do is make sure that every schedule contains a valid Employee ID. That, you want to make it impossible to create a schedule with an Employee ID ...


2

The column id is defined as SERIAL which is similar to the AUTO_INCREMENT property supported by some other databases. So you should omit it in the INSERT statement or use the DEFAULT keyword and the new id will be generated automatically. See section 8.1.4. Serial Types: http://www.postgresql.org/docs/9.3/static/datatype-numeric.html



Top 50 recent answers are included