PostgreSQL in Django 1.8

Video in TIB AV-Portal: PostgreSQL in Django 1.8

Formal Metadata

PostgreSQL in Django 1.8
Title of Series
Part Number
Number of Parts
CC Attribution 3.0 Unported:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor.
Release Date

Content Metadata

Subject Area
Among the topics are: A survey of the new Django 1.8 PostgreSQL features. Using migrations with PostgreSQL in interesting ways. Real-life applications of the new field types. Basic model design for good performance on PostgreSQL.
Point (geometry) Human migration Arm Computer animation Mapping Multiplication sign Projective plane Graph (mathematics)
Laptop Point (geometry) Sequel View (database) Multiplication sign Equaliser (mathematics) Source code 1 (number) Similarity (geometry) Insertion loss Disk read-and-write head Field (computer science) Array data structure Mechanism design Bit rate Operator (mathematics) Cuboid Software framework Endliche Modelltheorie Extension (kinesiology) Social class God Area Enterprise architecture Model theory Moment (mathematics) Electronic mailing list Stress (mechanics) Database Line (geometry) Human migration Subject indexing Type theory Query language Normal (geometry) Pattern language Musical ensemble Table (information)
Frequency Array data structure Matching (graph theory) Query language Order (biology) Electronic mailing list Right angle Data structure Dimensional analysis Element (mathematics) Reverse engineering
Filter <Stochastik> Link (knot theory) Transformation (genetics) Length Disk read-and-write head Field (computer science) Element (mathematics) Bit rate Different (Kate Ryan album) String (computer science) Integer Error message Boolean algebra Matching (graph theory) Mapping Gender Surface Optimization problem Expression Bit System call Substitute good Approximation Subject indexing Word Computer animation Predicate (grammar) Query language Network topology Table (information)
Service (economics) Data storage device Water vapor Instance (computer science) Element (mathematics) Subject indexing Type theory Inclusion map Array data structure Different (Kate Ryan album) Operator (mathematics) Order (biology) Integer
Length Matter wave Multiplication sign View (database) Equaliser (mathematics) Range (statistics) Archaeological field survey Mereology Dimensional analysis Computer programming Formal language Facebook Medical imaging Mathematics Array data structure Endliche Modelltheorie Physical system Relational database Electronic mailing list Data storage device Sampling (statistics) Type theory Hash function output Normal (geometry) Moving average Right angle Data type Resultant Spacetime Point (geometry) Classical physics Dataflow Overhead (computing) Link (knot theory) Online help Field (computer science) Number Wave packet Goodness of fit Operator (mathematics) String (computer science) Program slicing Energy level Integer Data structure Associative property Mathematical optimization Key (cryptography) Forcing (mathematics) Expression Rectangle Timestamp Subject indexing Radius Computer animation Query language Table (information)
Game controller Context awareness Identifiability Multiplication sign Translation (relic) Mereology Field (computer science) CAN bus Operator (mathematics) String (computer science) Core dump Extension (kinesiology) Matching (graph theory) Key (cryptography) Block (periodic table) Reflection (mathematics) Electronic mailing list Database System call Connected space Human migration Type theory Data management Query language Quicksort Object (grammar)
Point (geometry) Slide rule Group action Implementation Information overload Multiplication sign View (database) Mereology Graph coloring Field (computer science) Product (business) Attribute grammar Control system Physical system Scaling (geometry) Gender Data storage device Database Human migration Subject indexing Computer animation Query language output Pattern language Pressure Spacetime
Axiom of choice Default (computer science) Software developer Chemical equation Range (statistics) 1 (number) Database Field (computer science) Formal language Type theory Scalar field Order (biology) Right angle Selectivity (electronic) Ranking
Time zone Pairwise comparison Multiplication sign Range (statistics) Bound state Infinity Bit Open set Food energy Timestamp Field (computer science) Type theory Medical imaging Computer animation Query language Personal digital assistant Boundary value problem Right angle Damping Spacetime
Point (geometry) Pairwise comparison Constraint (mathematics) Sequel Gender Uniqueness quantification Multiplication sign Source code Range (statistics) Database Field (computer science) Human migration Subject indexing Exclusive or Computer animation Doubling the cube Operator (mathematics) Right angle Data conversion Endliche Modelltheorie
Constraint (mathematics) Multiplication sign Equaliser (mathematics) Uniqueness quantification Range (statistics) Combinational logic Database Inequality (mathematics) System call Field (computer science) Power (physics) Subject indexing Computer animation Different (Kate Ryan album) Operator (mathematics) Scalar field Family
Constraint (mathematics) Key (cryptography) Code Gender Multiplication sign Range (statistics) Database Mereology Human migration Revision control Type theory Subject indexing Exclusive or Process (computing) Different (Kate Ryan album) Query language Network topology Operator (mathematics) Energy level Integer Extension (kinesiology) Writing Exception handling
Slide rule Standard deviation Theory of relativity Inheritance (object-oriented programming) INTEGRAL Wrapper (data mining) Range (statistics) Diffuser (automotive) Database Special unitary group Food energy Field (computer science) Type theory Operator (mathematics) Representation (politics) Right angle Data structure Arithmetic progression Spacetime
Slide rule GUI widget System administrator Water vapor Raw image format Surgery Field (computer science) Number Medical imaging Goodness of fit String (computer science) Operator (mathematics) Representation (politics) Data structure Hydraulic jump Key (cryptography) Relational database Physical law Special unitary group Database Instance (computer science) Cartesian coordinate system Subject indexing Process (computing) Query language Object (grammar) Table (information) Library (computing)
Axiom of choice INTEGRAL Code Interior (topology) Multiplication sign Range (statistics) Combinational logic Set (mathematics) Computer reservations system Insertion loss Coma Berenices Function (mathematics) Run-time system Programmer (hardware) Exclusive or Roundness (object) Meeting/Interview Different (Kate Ryan album) Semiconductor memory Data conversion Endliche Modelltheorie Extension (kinesiology) Error message Social class Salem, Illinois Constraint (mathematics) Arm Structural load Software developer Feedback Gradient Stress (mechanics) Bit 3 (number) Special unitary group Type theory Order (biology) Right angle Summierbarkeit Quicksort Writing Row (database) Geometry Point (geometry) Open source Sequel Similarity (geometry) Field (computer science) Theory Number Workload Profil (magazine) Natural number Operator (mathematics) Program slicing Energy level Integer Condition number Boolean algebra Addition Multiplication Key (cryptography) Quantum state Inheritance (object-oriented programming) Gender Cellular automaton Expression Model theory Mathematical analysis Bound state Planning Database Limit (category theory) Cartesian coordinate system System call Vector potential Human migration Subject indexing Voting Software Personal digital assistant Query language Predicate (grammar) Network topology Video game Table (information)
what and the and the and the and and the point that the Holy yeah OK I would plunge right on in because we have so
much stuff to talk about I'm specifically what's it have in on gentlemen 7 introduced native migrations and enjoying 1 8 introduce general contributes graphs and the sermon the Senate Christopher given some time so let's but for the 1st 1 considers most of and you talk about in contribute which was then the map arm in blue the Kickstarter Indiegogo I forgot his Kickstarter project or who deserves the most praise for these wonderful new features so about migrations
enterprises away migrations of pose for specific and talk about migrations and the reason is that a lot similar stuff to talk about the enabler for other things in the genomes of migration to just amazing so if you have and use them just you know good laptop and defended instead movement using migration but and thank center for those so a quick overview of has used the ones of migrations work the treaty it like that box of immigration to build this notion of operations of each operation migration massive back federal troops human migration time so it adds a field adds a table that corresponds to a model that adds that something like that the lots of individual operations but there were super interesting ones from our point of view which I write SQL signal increased extension these are operations that are built into that come with the Django framework often work now and you can use them in your own migrations runs in all
probably because what it does it applies Rossi quadratic the database not everyone say 0 god as well as database guys talk about loss equal quandary watch again but really work with me here it's it's very very handy and specifically it's very useful for things you can't do directly in and using the the models yet like creating indexes for some new types were going to talk about there's also create extension operation which runs agree extension command you can sequester pattern is forming in this naming conventions all specifically the extension mechanism was which was introduced in 19 1 something like that and use isn't that like that proposed is allowed you to add extent package extensions into your database previously you had to drop of about so far fewer run the sequel here and all this stuff it was just horrible but the specifically we we talk about this extension each for which is the which needs to be added to your database before use it doesn't come with the class post Chris installation allowed us to make more sense later at the moment I'm just teasing you 1 thing to notice about each source if you have a answer query every can time you connect to the database but we'll talk about also but so that's area that I need to know about the new extension facility let's talk about 1 8 many adds a new field types which are fields range fields and a N. A. n H. 4 field on the main line is going to add some more cool stuff but this is what we get a 1 8 so in the field In risk since pretty much the band of time already the first-class types you have a single column that is in a way I don't know did you know what's what it is people like their heads explode at this point because this is the normalization of the suspected the forget those people the world in the way on the use this is a really really cool feature on and field is not field that you can import from non-genic of stress it lets you use those directly before the tons of fuel of the you could find undergo step and things like that that would would you it but now it's fresh out box and is that into Python arrays I said rate here is because I have been in the way but I mean of course is a list 1 thing to remember is that post restoration of homogeneous type unlike Python lists which are not so you get you pick a tight it's something and that's what you get in the post restaurant the but have found that you put of cost anything you want in a list but don't do that if this is what you're trying to model at
so with the other thing is the Python multidimensional arrays are rectangular remember federal on just like that is of the great that we're on earlier ancestors in this way of this so the traditional multidimensional arrays their research and create a 3 dimensional way with dimensions of 5 7 and 10 and the whole thing appears as populated for you the individual entries can be null if you need to represent a hole in the array but it's not like it's not like a list of lists structures where each individual element can be any size you want so once you got it has the about chasing the Carter said that you can't but are you going to do with it and you have a few queries the basic 1 is contains the the contains matches if you really feel that you left contains only on the end of the entries list on the right so ABC contains a b but it does not contain 80 but is not important in a contains query so you can continue up they can they get the period the year in any order you want you have also contained by which
is effectively the reverse matches of list of right contains all the entries of if you have any left so this this is not contained by that and that is not contained by that in but that is contained by the the August unimportant you're either OK that's it In
the maps so which is the any version of of this so this overlaps this but that not overlap that the the and the is a literature the Boolean then you have to have the the predicate underscore underscore land which returns like the which returns the moons of fewer than left as an integer so this is kind of approximate syntax you would actually write this your Python but you get the idea I'm that is so value you apply link to it you get to that's something to remember about this is that it unless you've created a petite and expression index which will talk about a bit this is going to do it for a further scan it will pick up every single word so in the database but for that table laughter let's to calculate the length and and filtering so you probably don't want to do that on a big table you can also apply our the transformations to it such as an index this takes about like for example this filters on everything whose 1st element spongeware 0 is a i is the string if there is no always 0 out the entries of for example the of the of the of the rate is of length is of length 0 it did then it doesn't match I'm interested which fast there's no error so if you put 5 million there and at 0 5 million length raised to the that falls for everything 1 thing was directly you can specify this programmatically you you built-in is it you build in a 0 there I you can use string substitution and is quot to that of course
slice the array which is free call you can say OK anything whose entries 0 2 1 0 that the probably more easily 0 2 2 contains a you can also in array fields on the surface the signal being indexical show and you're done right wrong sorry this it creates a B-tree index on the array which is pretty useless for a way so this is 1 of the downsides right now of using these is you have to if you want indexing on them and you almost certainly do what indexing yes it is a special magic so let's talk about that the the officials said that head pose crystals indexing this was supposed to different kinds of index which most people who are just using the gender war never see because you only get 1 kind of post out of it which is in the trees and you Django on which is a B-tree index Mitronix is a great they're really there and the blue coat with the the optimal solution to a particular problem which is the very fast the compact and they provide literary seeking rock of a B-tree index up up at and signed on the other you can use it to accelerate queries like greater than less than or equal is worth the tree indexes are great but they're not
perfect on specifically a B-tree index requires a totally ordered type like integers every integer is greater than less than or equal to another integer that those operations applied any 2 integers stringently water filter totally ordered the answer is a teachers and things like that or not only worked with the signal from 1 array to be greater than or less than another way you can make up something you can say well we're compare the elements in order and then you know all that but most people don't use arrays that way that's another interesting way of using an array but I do want you do do not always have things like the inclusion like the contains operation would you wanna do is say does this what and finally instances of this operator that contain this particular element no matter where they are in the away so post worse for what has you covered it has 2 different types of indexes which are just engine indexes 1st of all
I for this studying walk along a home if you from just services for generalizing on of index storage technique engine stands for generalized inverted index so now you know
on X is a general you 4 types that contain keys and values on in other ways neckties and just contain values not keys on each person j son are good examples of things the key value pairs just value lists June indexes are generally used for that kind of data structure Dusan axes are generally used for provides a petitioner mathematical space so like a point or range or rectangle is an example of something that would be indexed using just of you that have to be in the hall like is fine do the the details on this for the just roll yeah and the good part was was included just work you don't have to do anything magic to the 1 to happen but didn't maintained and managed and dumped in restoring everything all the good stuff happens to them impose so AppEngine indexes was inverted indexes the next part is these accelerate contains contain by overlaps you get you get the you will use the index as appropriate to make these guys go faster it doesn't help Luther slice operations that so be aware that so what this looks like at the signal level use you create index on part of before model using Gin that using gene is the part that indicates that what you want is a gym type index 1 thing to note is genes can be large especially there's a lot of data if there's a lot of data in the underlying table and not freed up they just don't you know run around creating them just cuz create and if you are going to be doing the operations that will be accelerated by you specifically suspect table don't create index give you have your throwing it was elicits a pedagogical exercise for yourself 1st
of if not saying 1 index link for example very common query is that we your is that where the link is greater than 7 I'm having a hard time coming up with example of how you wanna do this but the view the world is ride so with that people do this what you can do is create an expression index only underscore link is pos forces or a wavelength operation With the field you have to tell it which dimension you want your right the length of remember multidimensional arrays so dimension 1 N and dimension numbers or 1 based why yes because this was invented in the early nineties why do you ask you can also index slice operations like that so if you're going to be doing the of course the queries on this this slice equal that slice you can do those the but programs indicate this is an expression index so it's actually calculate this expression for each entry in the table and stuff it into an index for you but a smart enough that when you do the query and it sees a matching expression and we use the index instead of running the quickly expression again just recall this was and also presents a radius of 1 base as well what am I saying seemed like the thing to do the OK so now I have this good this machinery for doing array fields of language which wanna use in right field the 1st 1 is the it really is and you wanna store a you're getting things like on embassy until you have a very common situation is you recording where sensory input from a sensor and the sensors hands saying OK at this time stamp of 123 samples here they are and you images bank this into a few you could you normalize you can normalize its or not the normalizing it In create 2 tables name for the base sensor 1 3 flows but rather a lot of overhead so just stuff at an array 1 of the best uses for an array is a strong case before many to many tables the of 1 of the things that so for example the classic social networking problem you have things and you have people and people like things now the in your basic relational database model where you build this is you build an intermediate table that has a many to many table between people and things and every time something like something you certain entry into this many-to-many table and then you have 1 billion people 12 billion thing was and ask any you know the BED 5 petabyte many-to-many tables ha OK probably not so when you click on also do is indeed people feel a certain way of everything they like and in the end and the thing field survey of everything that that everyone who likes this thing because it is the the entries in awakening key fields so these can be integers that index to put to to the other side much more compact and efficient to query and you index each field I'm not sure I would build Facebook this way and a smaller system this will work very well all you can also use this is for the in analyzing the results of expensive queries for example you're doing that from your caching the results of a query but you might keep the many-to-many field for some other reason but could but I'm not have an optimization we're your story is a your normalization the compositions like this are generally need to be approached with caution about say never do them but down because you do have to worry about maintaining them the training data stays up-to-date things like that but it can be very useful OK and then we have a sure feels misery usage for impose worse OK so each there is a semi berth in hash for data type it's like a a Python data that only take strings as keys and values and i so it's a single level it has to be a string on each side the prudent gezondheid pose Chris this was the only way of storing unstructured data associative data like this it's not super powerful and you notice the semi in semi broken and we'll talk about what that means so 1st of all
how do you get each sort of work because if you land and you are faced with database and and trying created each shot a column you creatable block X it's further and further in saying I have no idea what these sort ideas because that actually built into pose it has to be installed before in a particular database before you can use it's not part core under the party is controller and Jane Contrapunctus comes with an age for extension that instead of you so you could because the migration of using them to create an empty migration add shore extension to operation to it and it will apply appeared that's good this is 1 of those which only matters if you're really pushing the performance of your database and for some reason you're not using connection pooling which you should be on the problem is that it has to do every time you connect the database 2nd PG to which everybody's basically using for using Python on has to connect to the direct object identifier feature type this could be different in every database so this adds 1 query to the connection it's usually not a big deal especially because Django has this thing about asking all sorts of questions with various on a reflection like Richard times on things like that so that's once when more agree among friends but he did you do have to be aware that's what's going on if you see this query fly by now you know what's going on so
on each stroke types are represented Python is a date around the keys in values must be strings not managers not lists not had not anything else on the translated to and from the database encoding so few databases in on something besides UTF-8 that be translated to the right encoding on on inside a Python please say your databases in UTF-8 because it's horrible if it's not really don't do that so but makes database DB ascribed on but if in the off chance it's not in UTF-8 do the translation for you on it so suppose contains an contains by both the key and the value have to match in of this and you have has K which matches fields containing a particular key such call and you have a has keys which takes a list just very useful on there's key which returns lists which are matches was the keys in the field so you can say thought would give me the land of the living fields whose come there that we are those whose feel has he his which contain either a or B that's pre and uses the same values each for field so you can
query on values as well the the interesting support
John indexes so exact same syntax of all of you the and accelerates contains has he has is but not contains by sorry just wage in the just with indexical fatigue store so I want to use a short field so it's group pressure very rare at tributes on and you actually touched on this in his part is great talk earlier on about database any patterns what which is your USC master or some other system even an inventory control system so that you said that the customer and use it to a bunch of customers if you don't want you know because really but they had at tributes guidance for example an inventory control system you might wanna be able to tell people OK for the item they wanna be able to add on ice Pianofortes a book or a color if it's the thing that comes in goes or sizes that not every item is going to have that you don't know when you ship your product out to the customer which attributes the red what we think we fields in individual fields of the database let's 1st kind kind-hearted gender and 2nd that would that the slides from a migrations an implementation point of view as well but you would you can use crystal each Schofield input used it as a place to store all of these random attributes on general and I want them as if they're going to be fields that are known 95 per cent of the time considered a short field instead also in and that but meant into remember in this in this use is that nothing else take 0 space impose for scale they don't actually take any room on desk so not causing any space by creating Melville's was 0 use social and another use for these is if you have the actually that's populated very very very rarely this is not with creating a whole field this is another solution to that the and user-defined attributes which we just talked about that being
said if you're doing greenfield development right now you probably won't use chase on instead especially once 1 . 9 comes out and we have 1st is on support in Django but if you have this right now there's adjacent on type B 1 8 so used decide a asserting a right away but you try to plug into an existing database which has a choice
no in increasing order callers we now come to range fields but mister now has been have range types with a sense of Stoneridge was um of the scalar type so for example 1 comedy as inferred range includes all of those that this is an inclusive rank so it includes those you can also write them as exclusive balance so for example 1 comic goes from 1 to 7 but doesn't include a so her yeah and that's a default notice that this is the place where skill syntax obviously you can't write this in Python and have be syntactically legal and the optical cool ones but the languages selection you that In this isn't but so the fact and that there is this but then 1 and close the door closed and one-sided binomial range but if you can even bound
it means a value greater than or less than for some types particularly dates happens to have a special infinity value I guess there's a special End of Days value and type side of the so so if you see 1 of those coming out of a query 1 the the same energy to the so that the the pretty much there's no reason not to use and if using Django you have to work hard not to use that also includes a Python range-based height on that handles all the various boundary cases and the infinity special cases and that's 1 of the the range fields in general built on top of I will
the Baths 1 8 supports image arranger BigInteger range so 32 bit 64 bit integers at range all the time range energy range I am I am pleased to say that the time ranges timestamp t with time zone in rest because if you're using timestamp without time of time-stamped easy you're probably making a very bad mistake so everybody go and make sure that you're using timestamp not timestamped easy not timestamp indeed the right the so contains having by an overlap and what we'd expect to on comparing 2 ranges there's also a fully less than fully greater than which is true of both the upper bounds Lower bounds if you a greater than or less than the comparison value so the whole thing just 1 side of the whole wages to the other it on adjacent to those you it is true if 2 exactly bump up against each other there's no space between them there no values and this is a place where the parentheses the open bound is useful because you can map on a closed down there is no way of doing this with continuous type there's no way of writing to flow ranges do ranges that are close that that exactly bumping into so that causes all this another float that you can shove into their design open range is important this not
less than has the fields contain does not contain any point source the comparison value and not greater than which works the other way the it really feels use just on the indexes which you can probably guess the syntax but here it is apt model using just field note that the review have to for now you have to drop this sequel who are migration you there's no way of saying this just at the gender model of all that's OK that's what principles for on all conversion operators that we are on the we described are accelerated by the by the gist of but by having just index on a range so well I would use
this well use a problem the what's it you we really haven't out in your mind is don't out looking for room to be inserted in database the same room for the dates overlap anyone to do this so how did solve this problem there's actually no way of solving this with traditional unique constraints because there's nothing that's necessarily unique you could say Room 1 0 2 4 Monday through Friday and another 2 for Tuesday through Saturday there's nothing there on those 2 taken together are not unique but that but they're so that's not that have both in database at the same time you double threat rats rats crap so how do we solve this problem but post-Christian rescue we have affect the sorting cost was called an exclusion constraint which is a relatively new feature I think 1 2 impose best bad allow you to to not have this situation rights the it's a generalization
of the idea of a unique constraint this was supplemented rabbit unique needs unique you can see the says when 2 values can be the same for this call you insert the OK that's fine when necessary don't allow any 2 values who both of which pass the early operator in there now of Senate the same thing we said in a slightly different way we've said don't want to things that that with this particular operator equality all in the database the same time the so we can say that the operator is inequality but the operators some other operator so you say don't allow to things in the database at the same time where the overlaps operator matches who will that's interesting because now and you say well OK and that's the you together to say these 2 fields can pass this operator in these 2 fields can pass this operator and then down to generalize the idea of you need to let you use any operators in combination with a and I think an example before important look at the faces
so there's a catch do you have a single index 4 so that for this whole shebang and range such approaches index the index has to be just index but the families we talked about this example we're using rooms and rooms just integer or string you know about the power of the hotels represent them loose scalar values go values don't have just typed or that have just indexing all we just blew it why was so there's grammars good you choose is great example how to set this problem impose person I can
well of course you can and because there's a magical tree guess which lets you create these indexes are mostly simple scalar types it's a post was extension as part of Contrail it has to be a standard database but it should suppose which means you can use the created extension migration to get into your database just about how would actually use this so
if you don't put miles import the the feel that here's a booking enters the room and here's the reign of this is probably a foreign key to a room but you know you get that's easy and then we say OK was local what's it look like now is the integer of that James created for us in the room and the range process OK so part of it now we create this extension tree just and we had this exclusion constraint than those were doing here for saying and this index for the room is equal and the date is Wed et and aren't and is the PostScript version of the because of the overlaps operator but so when overlaps query in gender which really get is this double ampersand the OK now let's try adding some rooms with all this say we're going to add a room and save that worked and room save so because it's the same room but entirely differ range at room save so far 7 the because the same way same time range the difference OK room to D 1 2 3 so we've so notice however this overlaps that then all look it can let me do that pretty girl and notice is this means the constraint is being 1st at the database level sure you could write code in Python that would do the quality and if the ever turn the and overlapping range say no those exceptions but that but the nice guy about databases if you doing bulk imports if you have other kinds of of on queries you and you can and this means that the database itself and courses
so you should use ranges relations represent ranges I hope you get a lot of value out of this slide on to both that there were no it's not natural and you get better operations than the traditional high-low pair of stuff in the database and you get more database integrity more interesting operators available now coming soon
hinges on fields under not money but I think of and 4 and ensure right of 1 9 on the diffuser super arbitrary dates on structures the standard of American progress both on genocide in on the on side on the business a post was has to choose on types just energies on B sorry about that any Jesus answers the relative to do some black white space and all is literally the text it is in fact a wrapper around postprocess text type the Sun B is a compact in that that's where representation it's a lot like it's it's more similar to be fun but it's a lot better so that
is just as the somebody it's faster to instances that have process needed to show the raw text in database in induced return highly dubious features that people use in days on which a digital object the same and stable object he water is about rather the there's nothing in the sense that that says that this will these features are available and use other people still use them bad people they should feel that there also this is OK if you just let found like you have a low table it's accumulating API calls or something like that we don't really need to process the suffer just 1 avid somewhere the so just be pretty much every other application wanted something it's if we index these ways unlike a sonnet on the 1st image sound field and Django uses the Sun B is underlying representation so this role on the Sun B has Jin indexing on just and just on the on the kind of indexes that leverages on a B-tree indexes the treat them like strings which is pretty much useless you get these operators the which is and the quality of the query has to be against the popular will the object in the index to be useful so you can index you can do query number nested J. substructure UK query for a key that's way down in the structure has to be the problem and that's being worked on and you can clearly nested objects but only has iterated to topple
so I want use just on support in general Burundi's on data and you know what a tables the request that schemas this is a very common problem in on database in relational databases we want a single out a table the handles both the other tables whether having 1 on a table for every other table which is that we never the slides on it's a nice way pickling jump I thought did see so that other tools can read them all on the the standard libraries the pickled Python objects into g sound kind polenta craft into them for my taste but if it will they work also end for those things that she's using straw for like you define objects were fields things like that on the on the on the new fields good and the new fields have admin widgets that go with them they're really very cool on this surgery somewhat is really good for debugging because you know you basically get the law text spat out to you and but you know why are you using the admin for this of and then executed multiversity 3 about but if end think
you questions it the if impose the rays are 1 index on the exam ple gave final crisis of filter was I 0 indexes Django converting yeah you it's also Python style indexing within Django because otherwise you would probably go insane the ion so they would because the 0 1 conversion for you OK so the the I Ch quick question but I expression indexes are expressed index is a B-tree indexes of and how did and you have the tree Jinan just indexes yes on the sum of an advanced class but for example you you know I can definitely see things like and if you if the output of the operations like a slice is of of is Jenna just urge integers indexable type then by all means you have a gender just expression indexing the purpose was does the right thing you on the but of the various geo extensions do this a lot per cool stuff so I'm used to having it be a superior to create extensions is there any hope to not be that permanently migrations of no yes sadly not yet settled because the because you could really serious screw your database with a with a bad grade extension super user access is going to be required which is really annoying if for example on RTs or you don't have super user so in the case that you don't use the creates tension situation you write many angry letters the Amazon asking for that extension of the natural Salem question of you do you have any tips on migrating must equal to post press on higher rests on there's Higgins et and that not like delivered as in there because of the small thing like this I will say that gets to the database layer is usually only about 25 per cent of the pay of the nightmare the rest the nightmare is the at the application level but it's not so if you've been reading the ruthless about your arm about your database agnosticism in Django you probably can get away with that without too much hassle arm and the tools that will probably do it for their but a surprising number of my single applications rely on things like the return primary key on query on query for all for novel thing that bicycle those and in DVD and things like that so most times you spend the time looking for my sequel isn't in the code actually rather which tools out there that actually do that will do the double conversion for you hi I are there are there any performance and improvements moving from a many to many table to an array and is a potentially huge because the when you think about how the many-to-many query works it has to potentially suck up a whole huge set of rows and go through these enormous indexes Indexes a fast but they're not infinitely fast and so on if you know there there is at the upper bounds I mean 1 billion role the item indexes are not be any more fun than a billion wrote table by on potential you could this could be a huge win especially using next as legend network work very quickly as an index is out so if for example if you a cue for the gene index everything that has a 4 and and can go pull those rows I could potentially much faster than I'm running through many to many table and smaller you mentioned that the new fields only our will only work with Jason B. in what you recommend an order if you want to use the plane J. Sun for those sort of theory of a evaluate your life choices in I don't see a the g the Burgess gezondheid does not have a lot of that good stuff in it you can get some of the by writing so if if you absolutely must you can move around getting you can write expression fields that extract the stuff out of the car that kept the extract those feels out of the trees on type index them as B tree of the things at the at some point go you're probably better off doing adjacent be unless you absolutely must have those 2 don't miss features trouble if querying isn't necessarily a goal in years why get access to it you like subtext Earth subclass um like that of the world and make it at least accessible hot served to do your own that in theory you could alter ego created and then alter the tied back to J. song and probably everything will work just fine so at that point on I have tried it but it's it was really be worth go on in the other thing of course is if you want the performance enhancement the the these these small but not 0 performance enhancement for it on inserts that g sine as already of you're voting example is really nifty I'm wondering out a couple other things so it be possible to create multiple conditions using the the trees just extension of so how would you recommend except will handling of the EU could come create as in not more than 1 predicate on the on we are not quite sure the question sorry so let's say that in addition to that date ranges of the did it once certain types of rounds to be about once yeah workload here is that it can be essentially that's the memories in that case I had to use the the B-tree just hack is because because 1 of the things 1 of the fields only has just indexing and the whole thing has to be the set has to be just index of all the indexes that are that are popular appearance exclusion constraints have to be of the same type so that's I had to 1st the Int the this is the strain and that was the room into it if for example everything and everything is a you right exclusion constraints as any combination of Boolean predicates and it together OK so effectively there is no reason to have a situation where you have multiple kinds of integrity there's that you'd have to you know the model it is if you have you can have 2 different exclusion constraints on the same table there's absolutely no limit to how many that have except that of course as a check on every answer which can be a little bit of going on so if you get 1 out it won't tell you all about the ladies 12 different exclusion constraints all failed you'll you'll hit 1 and then stop the uncertainty of that that 1 and injury remind so giving feedback to the user when there's an entire year's starter handling that's that that is a little more complicated in that case you may need to I I I would be I would actually do both both query a database in advance to get the right kind of error back to the user but still have the constraint in case you need you have other applications that don't run through the same URI that our try to insert data you train bulk load it from someplace else and using the COPY command or something like that that will you know because you know inevitably will happen is like take the room example you know your your hotel running fine and then hotels that com so comes in and says we want to send reservations but we have this API in the adult cell that had like I I I I I drew reservation systems are a tiny bit more complex than that example but you get the idea of the do you have any insight into what might be coming in 1 9 and beyond With regards to 1st stress on the in on at this point 1 9 Sprewell lap dancing this read the release notes I you know I I I'm not a contributor to that stuff directly so that would be the best analysis on the and on thanks to the great talk and how do you feel about the funding model of the contributions to Agenda the press Christoff another any other things you'd like to see the front in a similar way around that's probably will probably a longer quest of bigger question that I can answer right here it is interesting to me that that I have very strong opinions of the of the companies that use open source should give a little more back than they do on the on they're certainly features I would love to see like being able to push different and foreign key of 4 key cascading models unspecified those from of from the model level 0 for example if you want to have something other than delete but we will specify that inhabit implemented by the database rather than Django in implementing it on the yet getting getting money for these kinds extensions is but issue from Kickstarter is great but it does tend to be a popularity contest and In it knocks out of a lot of developers who would otherwise have of you know who were brilliant programmers but haven't worked as hard to do but don't have a high profile and that's a shame I think so tell your employer to write big checks is mine they and if you need anything done with you the prophesied base give us a call that thank them off even if the the the III