Tag Info

New answers tagged


The default Postgresql configuration will be used. The default PostgreSQL configuration is meant to be adequate for smallish servers. If you are worried about scalability, which you seem to be, then restricting yourself to using the default configuration is going to be a poor plan. WHERE p.name ILIKE ANY(potential_parts) You are probably going to ...


It appears you are looking for a SQL database that implements the SQL Standard CREATE ASSERTION statement. AFAIK there is no mainstream SQL database that actually supports this. Therefore, the more complex data integrity rules that you wish to implement must be done so programmatically. This can be done using triggers in the DBMS or procedurally either ...


I use before triggers for complex rules. This requires the ability to throw an exception from within the trigger for records that do not meet the conditions. Normally you only need to run these triggers before inserts and updates. There can be issues if the data you are validating against is being modified with the transaction. I generally use CHECK ...


This page explains how to deal with string lengths when Unicode characters are involved. CHARACTER_LENGTH is the function you need. CHARACTER_LENGTH(yourstring,CODEUNITS32);


Please check docs.oracle.com/database/121/ARPLS/d_metada.htm#ARPLS66868, especially part about invokers rights (added as an answer).


Based on Raj's comment, the following works: create or replace function utilities.getddl (p_type varchar2, p_object varchar2, p_owner varchar2) authid current_user return varchar2 as begin return dbms_metadata.get_ddl(p_type, p_object, p_owner); end getddl; select getddl('TABLE', 'MYTABLE', 'UTILITIES') from dual; <DDL>


Is there an explanation for the cardinality estimate of 1.0003 for SQL 2014 while SQL 2012 estimates 31,622 rows? I think @Zane's answer covers this part pretty well. Is there a good workaround? You could try creating a Non-Persisted Computed Column for LEN(cust_nbr) and then create a Non-Clustered Index on that Computed Column. That should only ...


Okay so this is what I've been able to find with some digging. For the legacy CE, I see the estimate is for 3.16228 % of the rows – and that is a “magic number” heuristic used for column = literal predicates (there are other heuristics based on predicate construction – but the LEN wrapped around the column for the legacy CE results matches this ...

Top 50 recent answers are included